Day 51 Task: Your CI/CD pipeline on AWS Part- 2

Day 51 Task: Your CI/CD pipeline on AWS Part- 2

Sep 24, 2023ยท

3 min read

Play this article

On your journey of making a CI/CD pipeline on AWS with these tools, we completed AWS CodeCommit.

Next few days you'll learn these tools/services:

  • CodeBuild

  • CodeDeploy

  • CodePipeline

  • S3

๐Ÿ”ถ What is CodeBuild?

  • AWS CodeBuild is a fully managed build service in the cloud. CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy. CodeBuild eliminates the need to provision, manage, and scale your build servers.

๐Ÿ”ถ Task-01: Buildspec file for Codebuild.

  • Read about the Buildspec file for Codebuild.

  • Create a simple index.html file in the CodeCommit Repository.

    1. Log in to AWS Management Console and go to CodeCommit.

    2. Create or select an existing secure repository to store and share your code.

    3. Clone the Repository

      1. Open the terminal and navigate to the directory where you want to clone the CodeCommit repository.

      2. Run the following command, replacing <repository-url> with the URL of your CodeCommit repository:

  •    git clone https://<repository-url>
  • When prompted, enter the Git credentials (username and password) you generated in the IAM user. This will authenticate your local Git client with CodeCommit.

  • You have to build the index.html using the nginx server.

๐Ÿ”ถ Task-02: Add the buildspec.yaml file to CodeCommit Repository and complete the build process.

  1. Create a buildspec.yaml file:

     version: 0.2
           - echo "Installing NGINX..."
           - sudo apt-get update
           - sudo apt-get -y install nginx
           - echo "NGINX installed."
           - echo "build started on 'date'"
           - cp index.hmtl /var/www/html
           - echo "Configuring NGINX.."
         - '**/*'

  2. Push the buildspec.yaml to CodeCommit:

    Use the git command to push the buildspec.yaml file to your CodeCommit repository:

     git add .
     git commit -m "Adding index.hmt and buildspec.yaml"
     git push origin master

  3. Set up CodeBuild:

    • In the AWS Management Console, navigate to AWS CodeBuild.

    • Create a new build project.

    • Configure your source provider (CodeCommit).
      Select source provider AWS CodeCommit, Repository and Branch master.

      Configure Environment:

    • Choose the build environment, and specify the buildspec file location (buildspec.yaml in the root directory), and set environment variables as needed.

    • Create the build project.

    • Start the build.

    • Check the logs and phases steps:

  4. Now Create an S3 bucket.

  5. Now Add Artifacts to a Codebuild and store them in the S3 bucket.

  6. Now Start building again.

  7. Now go to your S3 bucket and check for the index.html file under your bucket object.

  8. Now Select the open button to open the html file in the browser.

For more details watch this video.

Happy Learning :)

Stay in the loop with my latest insights and articles on cloud โ˜๏ธ and DevOps โ™พ๏ธ by following me on Hashnode, LinkedIn (, and GitHub (

Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.

#Git #Linux Devops #Devopscommunity #90daysofdevopschallenge #python #docker #Jenkins #Kubernetes #Terraform #AWS

Did you find this article valuable?

Support CHANDRESH PATLE by becoming a sponsor. Any amount is appreciated!