Posted On: May 13, 2020

We’re excited to announce the addition of -javaagent switch to Amazon CodeGuru Profiler that lets customers start the profiling agent using a command line. With this new change, you no longer need to modify your application’s code or add dependencies in order to run the agent.  

Amazon CodeGuru Profiler finds your most resource intensive lines of code and shows where your application is spending its time in the form of rich, interactive visualizations. It also looks for inefficiencies in your live applications, based on known performance issues and provides recommendations how to fix them.

The onboarding experience with -javaagent switch is now done in 2 steps:

  • Step 1 - Set application authorization permissions and 
  • Step 2 - Run your application with the profiling agent using the -javaagent switch (after downloading the agent’s standalone JAR)

The primary key benefits of starting the agent with the -javaagent switch is- you can now profile existing applications without recompiling or changing their code, you don't need to build the agent into their application jar, you don’t have to worry about incompatible versions of the Amazon SDK, and you can now also enable profiling in a broad range of hosting environments.  

If you plan to use the previous way to start the profiling agent, you can still start the profiling agent from your code. This is useful when you want to have custom authentication, have finer control, set automatic dependency updates, etc. Also, you will still be able to use either approach to start the profiling agent, as we will offer the CodeGuru Profiler Java agent both as a standalone Java agent JAR, as well as a JAR dependency that you can add to your applications as you do today. 

To get started with running the agent using -javaagent command line switch, you need to add the following command-line switch when starting the JVM-based application:


For example:

java -javaagent:AmazonCodeGuruJavaProfiler-1.0.jar=groupName=profiling-group-name \
-jar MyApplication.jar

Under the hood, CodeGuru Profiler uses the Java instrumentation API to start the profiler prior to any application code getting called (eg. before main() is called). This way, the profiler is configured with command line parameters or environment variables and there is no need to make changes to the source code. 

To learn more about Amazon CodeGuru, please see the features page. For more details on how to get started visit the documentation. For more information about automating code reviews and application profiling with Amazon CodeGuru check out the AWS ML Blog. To contact the services team visit the Amazon CodeGuru developer forum.