Install the Infrastructure agent on AWS Elastic Beanstalk

Amazon Web Services (AWS) Elastic Beanstalk is a dynamic service that allows easy deployment and scalability for your applications. Follow these instructions to deploy the New Relic Infrastructure agent to the instances launched with your AWS Elastic Beanstalk applications.

In addition to deploying New Relic Infrastructure you can also integrate New Relic with AWS and bring Elastic Beanstalk monitoring information into New Relic. If you haven't already done so, follow these instructions for Amazon integrations with New Relic Infrastructure.

Requirements

Make sure you have a supported Amazon Web Services account. In addition, for any New Relic installation, you will need your New Relic license key. This is a 40-character hexadecimal string that New Relic provides when you sign up for your account.

Install the Infrastructure agent

To install New Relic Infrastructure's agent on instances launched with AWS Elastic Beanstalk:

  1. In the .ebextensions folder inside your Elastic BeanStalk application, create a new file named newrelic.config.
  2. Based on the operating system, add the following content to the file, replacing YOUR_LICENSE_KEY with your New Relic license key.

    Linux
    files:
      "/etc/newrelic-infra.yml" :
        mode: "000644"
        owner: root
        group: root
        content: |
          license_key: YOUR_LICENSE_KEY
    
    commands:
    # Create the agent’s yum repository
      "01-agent-repository":
        command: sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64/newrelic-infra.repo
    #
    # Update your yum cache
      "02-update-yum-cache":
        command: yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
    #
    # Run the installation script
      "03-run-installation-script":
        command: sudo yum install newrelic-infra -y 
    Windows
    packages:
      msi:
        infrastructure: https://download.newrelic.com/infrastructure_agent/windows/newrelic-infra.msi
    files:
      "C:\\Program Files\\New Relic\\newrelic-infra\\newrelic-infra.yml":
        content: |
          license_key: YOUR_LICENSE_KEY
    commands:
      01_stop-newrelic-infra:
        command: net stop newrelic-infra
        ignoreErrors: true
      02_start-newrelic-infra:
        command: net start newrelic-infra
        ignoreErrors: true
  3. Push your app to Elastic BeanStalk:

    • In general, use eb deploy.
    • If you are still using Eb CLI 2.6 , use git aws.push if required.
    • Optional: Use the AWS Console UI.

After a successful setup, it can take up to fifteen minutes before metrics begin to appear in New Relic. View your host's infrastructure Compute page at infrastructure.newrelic.com.

For more help

Recommendations for learning more: