DEV Community

AWS Community Builders

AWS CI/CD pipeline with CodeGuru & UnitTest

Salah Elhossiny
ML engineer || AWS Certified MLS || AWS Community Builders member || Fullstack developer
Updated on ・5 min read

This post explains how to build a CI/CD pipeline using AWS services. It also explains how to organize various ways to improve code quality (CodeReview & UnitTest) in the AWS pipeline.

It covers simple branch build and deployment, UnitTest report, and CodeGuru which automatically performs code review when create pull-requests.


AWS Code Series (AWS CI/CD services)

You can use the AWS Code Series. Code series is a fully managed service, so there is no need for a infrastructure.

  • CodeCommit: AWS CodeCommit is a fully-managed source control service that hosts secure Git-based repositories.
  • CodeBuild: AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy.

  • CodeDeploy: AWS CodeDeploy is a fully managed deployment service that automates software deployments to a variety of compute services such as Amazon EC2, AWS Fargate, AWS Lambda, and your on-premises servers.

  • CodePipeline: AWS CodePipeline is a fully managed continuous delivery service that helps you automate your release pipelines for fast and reliable application and infrastructure updates.

AWS CodeGuru

Amazon CodeGuru is a machine learning service for automated code reviews and application performance recommendations.

It helps you find the most expensive lines of code that hurt application performance and keep you up all night troubleshooting, then gives you specific recommendations to fix or improve your code. It supports JAVA, repository can use GitHub or CodeCommit. It is also easy to integrate.


CodeGuru Reviewer that provides Automated CodeReview

Amazon CodeGuru Reviewer finds issues in your code and recommends how to remediate them.


The contents that CodeGuru Reviewer detects can be this categories.

  • AWS Best Practices : AWS APIs contain a rich set of features to ensure performance and stability of software.
  • Concurrency : CodeGuru Reviewer identifies problems with implementations of concurrency in multithreaded code

  • Resource Leaks : CodeGuru Reviewer looks for lines of code where resource leaks might be occurring.

  • Sensitive Information Leak : Sensitive information in code should not be shared with unauthorized parties.

CodeGuru Profiler

Amazon CodeGuru Profiler is always searching for application performance optimizations, identifying your most expensive lines of code and recommending ways to fix them to reduce CPU utilization, cut compute costs, and improve application performance.

For setup steps, you can find it here and here

CodeCommit Setup and source code download

  1. let’s set up the code in Cloud9. Enter the following command in the terminal of Cloud9.
~ git clone
Enter fullscreen mode Exit fullscreen mode
  1. If the command is executed successfully, created a folder name amazon-cicd-concurrency-sample-application in the file cloud9 file tree.


  1. clone gets the master branch. If you look at the contents of the folder, there are no other files except the file. the real source code in develop, pull the develop branch.
~ cd amazon-cicd-concurrency-sample-application
~ git checkout origin/develop -b develop
Enter fullscreen mode Exit fullscreen mode


  1. To check the output of CloudFormation, go to the CloudFormation console.

go to the CloudFormation console :

  1. Select Stacks from the left menu and select CodeQuality-Workshop you created. You can check the detailed information of the stack created here.


  1. Select Outputs at the top of the stack details. There you copy the URL of CodeCommit that lab `a repository.


  1. Change the url of origin to the address of the newly created codecommit at

Entering the following in the terminal of Cloud9. is the changeCodeCommit copied from the Stack of CloudFormation.

~ git remote set-url origin <YOUR-REPOSITORY-URL>

After finished the command, check again with git remote show origin, and you can see that the URL of origin has been changed to your CodeCommit address.

After that, you can checkout to master branch first then push commits. Then, develop branch and push commits.

~ git checkout master
~ git push
~ git checkout develop
~ git push

CodeGuru Reviewer setup


  • Select Associate repository at the top right.


  • Select AWS CodeCommit as the Source provider for Repository details, then select concurrencysample at Repository location. and click Associate.


  • Check the connected concurrencysample in Codeguru’s Dashboard.


  • Now CodeGuru and Codecommit are linked.

CodeGuru profiler setup


  • Select Create profiling groups at the top right.


  • Enter concurrencysample-profiler in Name of Profiling group details in Create profiling group. click Create at the bottom right.


  • Enter WebAppRole in choose users and roles in the Manage permissions for concurrencysample-profiler box. Select the checkbox on the left and click Save to save.


  • Profiler can be found in the main of the source code,

  • Now CodeGuru profiler and instance is complete.

CodeBuild report


  • Enter Concurrency-Unittest-Report in Report group name of Rport group configuration. Select Test for the report type. Uncheck the box for Export to Amazon S3.


  • To copy the ARN of the report groups, Concurrency-Unittest-Report from Report groups. The results of the Unittest here will now be shown. Copy the contents of Report group ARN of Configuration.


  • Now let’s go back to Cloud9 and edit buildspec.yml. buildspec.yml is located in ConcurrencySample’s root directory.

  • Double-click the file to add content. Paste the Report group ARN to .

- '**/*'
base-directory: 'build/test-results/test'

  • Commit and push them to codecommit.

~ cd amazon-cicd-concurrency-sample-application
~ git add .
~ git commit -m "change Buildspec.yml"
~ git push

Now we finished the first part in this series.

Discussion (0)