---
title: Configure the infrastructure agent on AWS Elastic Beanstalk
source: https://docs.newrelic.com/docs/infrastructure/infrastructure-agent/config-management-tools/configure-aws-elastic-beanstalk
---

Amazon Web Services (AWS) [Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk) is a dynamic service that allows easy deployment and scalability for your applications. Follow these instructions to deploy the infrastructure agent to the instances launched with your AWS Elastic Beanstalk applications.

In addition to deploying the infrastructure agent 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 infrastructure monitoring](https://docs.newrelic.com/docs/infrastructure/infrastructure-integrations/getting-started/connect-aws-integrations-infrastructure).

## Requirements

Make sure you have a supported [Amazon Web Services account](http://aws.amazon.com/elasticbeanstalk/). In addition, for any New Relic installation, you will need your license key. This is a 40-character hexadecimal string that New Relic provides when you [sign up](http://newrelic.com/signup "Link opens in a new window") for your account.

## Install the infrastructure agent [#download]

To install the infrastructure 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:

    -   Replace `YOUR_LICENSE_KEY` with your New Relic license key.
    -   Replace `x86_64` with `aarch64` when running on ARM (Graviton).

        **Amazon Linux 2**

        ````yml
        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/amazonlinux/2/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
        ```

        ````

        **Amazon Linux 2023**

        ````yml
        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/amazonlinux/2023/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**

        ````yml
        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`](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-deploy.html).
    -   If you are still using [Eb CLI 2.6](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli.html) , 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 pages at **[one.newrelic.com](https://one.newrelic.com/all-capabilities)**.

## Configure the infrastructure agent

To configure the infrastructure agent, either adapt the agent configuration file or use environment variables to determine the [agent settings](https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/configuration/infrastructure-agent-configuration-settings/) based on our requirements.
Settings can be applied using any of the methods listed below:

-   Settings in file: Edit the `newrelic.config` file in the `.ebextensions` folder with additional agent settings. Settings should be included in the `newrelic-infra.yml` file content.
-   Settings in environment variables: Define the required `NRIA_*` environment variables via Elastic Beanstalk UI, API or CLI. It's also possible to define them via `option_settings` in the `newrelic.config` file. Learn more from [AWS Beanstalk documentation](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-softwaresettings.html).

## Uninstall the infrastructure agent

To uninstall the agent, update the `newrelic.config` from `.ebextensions` with the following configuration, then update the deployment.

**Amazon Linux**

````yml
commands:
  # Remove agent configuration file
  "04-agent-remove-config":
    command: sudo rm /etc/newrelic-infra.yml
  #
  # Uninstall infra agent
  "05-agent-uninstall":
    command: sudo yum remove newrelic-infra -y
```

````

**Windows**

````yml
commands:
  03_uninstall-newrelic-infra:
    command: wmic product where name="New Relic Infrastructure Agent" call uninstall
    ignoreErrors: true
```

````
