AWS Public Sector Blog

Lower AWS expenses with Amazon CodeGuru runtime optimizations

Amazon Web Services (AWS) launched Amazon CodeGuru (Preview), a machine learning service for automated code reviews and application performance recommendations, at AWS re:Invent 2019. The new service helps development teams find code defects or performance issues and gives recommendations to improve code quality, saving time and expense. Amazon CodeGuru currently focuses on Java—one of the more widely used languages in public sector organizations like healthcare and government—and has good support for Java Virtual Machine (JVM) languages such as Kotlin and Scala.

CodeGuru (Preview) combines two services: CodeGuru Reviewer, which analyzes code before deployment, and CodeGuru Profiler, which monitors live application performance when the code is deployed and executed. In both cases, CodeGuru provides recommendations to fix or optimize code through trained machine learning models.

How does Amazon CodeGuru work?

CodeGuru Reviewer is triggered by a pull request notification that helps developers identify code-level issues before they are introduced to the broader codebase and become more difficult to identify. When an issue is identified, it is reflected in the CodeGuru Reviewer dashboard along with recommendations on how to fix the issue, links to documentation, and examples (when available). You can automate code reviews in GitHub and AWS CodeCommit repositories.

Once the application is deployed, CodeGuru Profiler begins monitoring your applications’ runtime performance, focusing on identifying your most “expensive” lines of code—code that takes longer time to run or uses higher-than-expected CPU cycles. When optimizations and alternatives are available, the CodeGuru Profiler will make recommendations to reduce CPU use, lower compute costs, and improve application performance.

CodeGuru is powered by machine learning (ML), trained on Amazon internal projects and best practices, and thousands of open source projects on GitHub. The training data is compiled from Amazon developers and performance engineers developing applications and profiling internal services.

Lowering AWS costs with CodeGuru

In 2018, a Stripe and Harris study found that companies spend $85 billion each year dealing with bad code. CodeGuru Reviewer uses ML to avoid introducing issues that are difficult to detect, troubleshoot, reproduce, and root-cause. Reviewer can help limit the chances of poor quality code making it into your codebase as you write, run, re-write, and re-run your application, known as the inner loop development process. This improves the performance of your application and cuts down on the amount of time spent chasing down difficult to identify issues.

CodeGuru Profiler identifies code-level issues that are unnecessarily consuming CPU cycles, alerting you to the method/function and offering optimizations when alternatives are available. Since AWS resources are pay-as-you-go, optimizing your applications’ runtime performance is a way to control your AWS bill and improve your applications’ performance.

CodeGuru service supportability

Amazon CodeGuru Profiler currently supports applications written in all JVM languages. The CodeGuru Reviewer functionality currently supports Java codebases on AWS CodeCommit and all cloud-hosted, non-enterprise versions of GitHub products, including Free/Pro/Team, as code repositories.

Amazon CodeGuru Profiler does not have any code repository dependence and works with Java applications hosted on Amazon Elastic Compute Cloud (Amazon EC2), containerized applications running on Amazon Elastic Container Service (Amazon ECS) and Amazon Elastic Kubernetes Service (Amazon EKS), serverless applications running on AWS Fargate, and on-premises hosts with AWS credentials.

To get started with CodeGuru, visit the CodeGuru console, the CodeGuru FAQs page, or check out CodeGuru Documentation.