This page covers installing the New Relic Java agent on AWS Elastic Beanstalk by adding the agent to your application bundle and configuring the -javaagent JVM argument through the Elastic Beanstalk console.
Compatibility and requirements
Supported
- Java 8, 11, 17, 21, 24, 25, and 26 (Java 7 supported on agent v6.5.4 and earlier only)
- Elastic Beanstalk Tomcat platform
- Elastic Beanstalk Java SE platform
- See compatibility and requirements for supported framework and library version ranges
Not supported
- Docker containers on Elastic Beanstalk — use the Docker install method instead
- Running alongside other APM agents — the Java agent cannot guarantee correct behavior when another APM agent is active in the same JVM
You need
- A New Relic account and
- A JVM with SHA-2 (256-bit) SSL support
- An AWS account with your Java app deployed on Elastic Beanstalk
Install
Download newrelic-java.zip and extract newrelic.jar and newrelic.yml: [#install-step-1]
$curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip$unzip newrelic-java.zipAdd newrelic.jar and newrelic.yml to WEB-INF/lib/ in your WAR file, then repackage and deploy.
Add newrelic.jar and newrelic.yml to a subdirectory in your project (for example, opt/newrelic/).
Add a Procfile at the root of your source bundle with the -javaagent flag:
web: java -javaagent:opt/newrelic/newrelic.jar -jar YOUR_APPLICATION.jarRepackage and deploy the source bundle.
Configure
Edit newrelic.yml and set the two required values:
- Set
license_keyto your . - Set
app_nameto a meaningful name for your application.
Tomcat platform only — Pass the -javaagent flag via the Elastic Beanstalk console:
Open the Elastic Beanstalk console and select your environment.
In the left pane, select Configurations.
Scroll to Updates, monitoring, and logging and click Edit.
Under Platform Software, add to the JVM Options field:
-javaagent:/full/path/to/newrelic.jarTo find the path to
newrelic.jaron the EC2 instance, connect to the instance and run:bash$sudo find /var -name "newrelic.jar"$sudo find /usr -name "newrelic.jar"Click Apply.
For all other configuration options, see Java agent configuration.
Verify your install
Elastic Beanstalk will update your environment. Send at least two requests, then wait 2–3 minutes and your app appears in APM & services.
If no data appears after five minutes, see No data appears (Java).