If you are an AWS Elastic Beanstalk user, the Java agent requires additional configuration.
Prerequisites
Before completing the configuration, you must first:
- Create a supported Amazon Web Services account.
- Create a New Relic account.
- Download and install the Java agent.
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:
In your WAR file, add the
newrelic.jar
andnewrelic.yml
files toWEB-INF/lib/
.Repackage and deploy your new WAR file as a new application or an update to a previous application.
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:In the AWS console, open the Elastic Beanstalk.
Select the relevant region.
Select your environment.
In the left pane, select Configurations.
Scroll to Updates, monitoring, and logging and select Edit in the upper right corner.
Scroll to Platform Software and add the following line to the JVM Options field:
bash$-javaagent:/full/path/to/newrelic.jarSelect 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:
Add the
newrelic.jar
andnewrelic.yml
files to your project, such in a subdirectory namedopt/newrelic
.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 theProcfile
:web:java -javaagent:path/from/bundle/root/to/newrelic.jar -jar <your-application>.jarRepackage and deploy the source bundle to your Elastic Beanstalk.