AWS CodePipeline (CI/CD Pipeline)

Creating a CICD pipeline with AWS CodePipeline

Introduction to Sample Application

Welcome to this hands-on tutorial on AWS CodePipeline. In this lesson, you’ll explore three CI/CD pipeline configurations for a sample application. We start with a minimal two-stage design and progressively add Build and Test stages to demonstrate a fully managed AWS pipeline.

Table of Contents

  1. Pipeline Configurations Overview
  2. Lab 1: S3 → CodeDeploy (Two-Stage Pipeline)
  3. Lab 2: CodeCommit → CodeDeploy (Two-Stage with Git)
  4. Lab 3: Add Build & Test Stages (Four-Stage Pipeline)
  5. Summary of Pipeline Variants
  6. Next Steps & References

Pipeline Configurations Overview

AWS CodePipeline orchestrates the flow from source to deployment through automated stages. In this tutorial, we’ll cover:

  • Two-stage pipeline with Source and Deploy
  • Git-based source using AWS CodeCommit
  • Four-stage pipeline with Build and Test phases added

Lab 1: S3 → CodeDeploy (Two-Stage Pipeline)

In our first lab, we use Amazon S3 (with versioning enabled) as the source and AWS CodeDeploy to deploy artifacts to EC2 instances. This setup demonstrates the minimal viable CI/CD pipeline.

Note

Ensure your S3 bucket has versioning enabled to track every deployment artifact.

The image illustrates a DevOps process flow using AWS services, featuring Amazon S3 as the source and AWS CodeDeploy and EC2 for deployment.

Key Steps

  1. Create an S3 bucket with versioning
  2. Define a CodePipeline with Source → Deploy stages
  3. Configure CodeDeploy application and deployment group targeting EC2

Lab 2: CodeCommit → CodeDeploy (Two-Stage with Git)

Next, we replace S3 with AWS CodeCommit, AWS’s managed Git repository, as our source. The two-stage pattern remains—CodeCommit feeds directly into CodeDeploy on EC2.

Warning

Make sure your CodeCommit repository has the correct IAM permissions for CodePipeline access.

The image illustrates a DevOps process flow with AWS services, featuring AWS CodeCommit for source control and AWS CodeDeploy for deployment, integrated with AWS EC2.

Key Steps

  1. Initialize a Git repo in CodeCommit
  2. Grant CodePipeline service role access to CodeCommit
  3. Define pipeline stages: Source (CodeCommit) → Deploy (CodeDeploy)

Lab 3: Add Build & Test Stages (Four-Stage Pipeline)

In our final demonstration, we enhance the pipeline by inserting Build and Test phases between Source and Deploy. This ensures code quality and automated testing before deployment.

Stages

  • Source: CodeCommit
  • Build: AWS CodeBuild
  • Test: Custom test runner or CodeBuild project
  • Deploy: AWS CodeDeploy

Benefits

  • Automated compilation and unit testing
  • Early detection of code defects
  • Streamlined continuous delivery process

Summary of Pipeline Variants

LabSourceBuildTestDeployDescription
Lab 1Amazon S3CodeDeployMinimal two-stage pipeline
Lab 2AWS CodeCommitCodeDeployGit-based two-stage pipeline
Lab 3AWS CodeCommitAWS CodeBuildCustom/Test RunnerCodeDeployFull four-stage pipeline with build & test

Next Steps & References

Ready to dive into Lab 1? Proceed to Lab 1: S3 → CodeDeploy and start configuring your pipeline.

Watch Video

Watch video content

Previous
CodePipeline Limitations