• /
  • EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

AWS Elastic Beanstalk installation for Java

If you are an AWS Elastic Beanstalk user, the Java agent requires additional configuration.

Prerequisites

Before completing the configuration, you must first:

To complete Java agent installation on AWS Elastic Beanstalk, follow the steps for your platform:

Tomcat platform

For applications deployed with the AWS Elastic Beanstalk Tomcat Platform:

  1. In your WAR file, add the newrelic.jar and newrelic.yml files to WEB-INF/lib/.

  2. Repackage and deploy your new WAR file as a new application or an update to a previous application.

  3. Locate and connect to the underlaying EC2 instance. Once connected, find the path to newrelic.jar file using this command - ensure you search one directory at a time. Use either /var or /usr as appropriate.

    bash
    $
    sudo find /var -name "newrelic.jar"
    $
    sudo find /usr -name "newrelic.jar"

    To pass the -javaagent flag to the JVM:

  4. In the AWS console, open the Elastic Beanstalk.

  5. Select the relevant region.

  6. Select your environment.

  7. In the left pane, select Configurations.

  8. Scroll to Updates, monitoring, and logging and select Edit in the upper right corner.

  9. Scroll to Platform Software and add the following line to the JVM Options field:

    bash
    $
    -javaagent:/full/path/to/newrelic.jar
  10. Select Apply to save.

Your Elastic Beanstalk will then update your environment.

Java SE Platform

For applications deployed with the AWS Elastic Beanstalk Java SE Platform:

  1. Add the newrelic.jar and newrelic.yml files to your project, such in a subdirectory named opt/newrelic.

  2. To use custom JVM arguments with your Java SE application, we recommend that you include a Procfile at the root of the source bundle of your application. See Java SE documentation for details.

    Pass the -javaagent flag as a JVM argument in the Procfile:

    web:java -javaagent:path/from/bundle/root/to/newrelic.jar -jar <your-application>.jar
  3. Repackage and deploy the source bundle to your Elastic Beanstalk.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.