DEV Community

Sandipkumar Patel for AWS Community Builders

Posted on

Create a CICD Pipeline using AWS CodeCommit, CodeBuild | Part-1

Pre-requisites:

  • You should have an AWS account created and you should sign in as IAM-User and not the root user.

  • Git installed in your machine

The pipeline created during this tutorial will start execution when changes are made in code repository and search for the word “Congratulations” in the sample.html present in code repository if the word is not present the pipeline will result in Failed status.

Step 1:

Get the Git credentials to clone the codecommit repository in the local machine.

Step 2:

Create a CodeCommit Repository

Step 3:

Clone the codecommit repository in the local machine.

Step 4:

Create any sample file and push it to the codecommit repository.

Step 5:

Create a CodeBuild Project

  • A codebuild project is created wherein, while executing the pipeline in build stage, linux command to search for word “Congratulations” in the sample.html file will be mentioned in the buildspec.yml file.

  • Add the buildspec.yml file at the root of CodeCommit repository.

Step 6:

Create a pipeline, using AWS CodePipeline

  • Choose AWS CodeCommit as SourceProvider and select the Repository Name and Branch Name.

  • For pipeline to get triggered when there is a change in the code repository, we will AWS CloudWatch Events in Change Detection Options

  • Choose the Build Project created, in the Build Stage.

Pipeline in execution when changes made in CodeCommit.

Execution

  • Pipeline failed since “Congratulations” word is not present in sample.html

  • Now we will make change in sample.html and add “Congratulations” word and pipeline will be successfully executed.

Top comments (0)