TechTarget.com/searchcloudcomputing

https://www.techtarget.com/searchcloudcomputing/tutorial/Get-started-with-Amazon-CodeGuru-with-this-tutorial

Get started with Amazon CodeGuru with this tutorial

By Will Kelly

Code quality is a growing concern for enterprises building cloud-native applications. Amazon CodeGuru is a developer tool from AWS that lets developers identify their application's most expensive lines. The tool then provides recommendations for remediation.

CodeGuru also monitors application performance in production. It then delivers recommendations to developers about how they can further improve code quality and application performance while helping reduce your cloud costs.

Inside Amazon CodeGuru

With the AWS Free Tier, CodeGuru is available at no cost for 90 days. You can review up to 100,000 lines of code for CodeGuru Reviewer. CodeGuru has two services:

How to use Amazon CodeGuru

For this tutorial, access CodeGuru through the AWS Console. Set up and configure your CodeGuru environment. AWS includes complete documentation to guide you through the following setup steps:

  1. Sign up for AWS.
  2. Configure IAM permissions for CodeGuru Reviewer.
  3. Install or upgrade and then configure the AWS CLI.
  4. Create a repository for your source code.

Open Amazon CodeGuru

Access Amazon Code Guru from the AWS Console:

Step 1. Log in to the AWS Console using your authorized credentials.

Step 2. Type Amazon CodeGuru into the search field.

Access CodeGuru recommendations

From the code reviews page, select the code analysis you want to view. My example code received 125 recommendations.

When you click on the hyperlinked title of the recommendation, CodeGuru takes you to the line of code in GitHub that the recommendation mentions.

How to use CodeGuru Profiler

To start using CodeGuru Profiler:

Step 1. Choose CodeGuru Profiler in the Getting Started drop-down list.

Step 2. Click Get Started.

Step 3. Type in a descriptive name for your profiling group in the name field.

Step 4. Choose your compute platform.

Step 5. Optionally, click Add new tag to tag your resources.

Step 6. Advance to the setup page, it appears similar to the following:

Step 7. Follow the steps and prompts to set the permissions and start the monitoring agent.

View profiling groups

Go to the left-hand menu and click on Profiling groups. The profiling groups accessible to you are visible. Select a profiling group to view.

You also have access to recommendations similar to the following:

How to use CodeGuru Reviewer

CodeGuru Reviewer lets you create CI workflows, run a code analysis and review recommendations from the code analysis.

Create CI workflows in GitHub

Deploying CodeGuru Reviewer as part of a DevOps continuous integration/continuous development (CI/CD) toolchain is a step toward automation of code reviews during development. AWS doesn't restrict you to just AWS tools for integrations.

Create a CI workflow in GitHub

Step 1. Select CI workflows from the left-hand menu.

Step 2. Optionally, click Set up CI workflow with GitHub. The Amazon CodeGuru for GitHub Actions appears. Copy and paste the code snippet into your GitHub Actions .yml file.

Run a code analysis and review

Amazon CodeGuru Reviewer lets you run two types of code analysis:

Perform a code review

Step 1. Open Amazon CodeGuru from the AWS Console.

Step 2. Select Associate repository.

Step 3. Choose your source provider. For this tutorial, I chose a GitHub repository.

Step 4. Follow the prompts to connect CodeGuru to your GitHub account.

Step 5. Build your repository analysis by selecting a source branch. Then you have the option to name your code review. I called my analysis CodeGuru-Review.

Step 6. Click Associate repository and Run analysis. The code reviews page will appear in 5 to 10 minutes.

Optional steps include the following:

27 Feb 2023

All Rights Reserved, Copyright 2010 - 2025, TechTarget | Read our Privacy Statement