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:
- 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.
sudo find </var | /usr> -name "newrelic.jar"
Pass -javaagent flag to JVM
To pass the -javaagent
flag to JVM in AWS Elastic Beanstalk
In the AWS console, open the Elastic Beanstalk.
Select the relevant region.
Select your application.
In the left pane, select Configurations.
Open Software Configuration.
Under Container Options, add the following in the JVM options field:
-javaagent:/full/path/to/newrelic.jar
Select Apply to save.
Your Elastic Beanstalk will then update your environment.