The instructions and files in this Gist can be used to configure an EC2 instance to install both the New Relic .NET Agent and Server Monitor on an EC2 deployed inside of an Elastic Beanstalk, without creating a custom AMI. Once configured, EC2s will begin reporting application and server metrics automatically to New Relic, even as the Elastic Beanstalk scales up and adds more EC2s.
- Create a top-level directory in your source bundle called .ebextensions and add newrelic.config to it.
- Change the values in newrelic.config to match your configuration, where:
- download_path_to = URL to download the PowerShell script and New Relic Agents (e.g. an S3 bucket)
- platform = choose the installer appropriate for your system (i.e. x86 or x64)
- version = the latest version of the New Relic Agent
- new_relic_license_key = your New Relic license key
- Add an application setting to your application's configuration (i.e. web.config) named NewRelic.AppName, and set its value to the name of the application.
- Deploy your application to Elastic Beanstalk.
- The EnableEc2SetComputerName.ps1 PowerShell script configures the EC2 instance to use a unique computer name based off their private IP address. This allows each server to be reported independently of other EC2 instances sending data to New Relic. Without configuring unique names, EC2s will appear as a single server in NewRelic. This modification to the EC2 requires a reboot.