Real-world CodePipeline CI/CD examples

Michael Wittig – 21 Apr 2021

AWS CodePipeline helps us to orchestrate CI/CD pipelines. To implement real-world pipelines, CodePipeline calls additional AWS services to do the work. E.g., CodeBuild to run arbitrary scripts, CloudFormation to create or update stacks, or CodeDeploy to deploy software to running EC2 instances. A pipeline is connected to sources such as a git repository (Bitbucket, GitHub, and GitHub Enterprise Server, CodeCommit), an S3 bucket, or an ECR repository. If a source changes, the pipeline executes.

Real-world CodePipeline CI/CD examples

But how do real-world pipelines look like? In this post, I share pipelines with you, from simple to complex.

Simple but bold pipeline

The following pipeline connects to a GitHub repository. CodeBuild is used to build a Docker image, and CodeBuild is used to push the Docker image and deploy it into production.

Simple but bold pipeline

This pipeline comes with several disadvantages:

  1. It runs no unit tests
  2. It runs no acceptance tests in a pre-prod environment

Manual acceptance testing

The following pipeline excerpt shows a pipeline where manual acceptance tests prevent bugs from reaching production. Not perfect, but better than before!

Manual acceptance testing

We could still do better by running automated acceptance tests, right?

The following video goes into details and includes demos:

  • CodePipeline 101
  • Real-world CodePipeline examples
  • Demo: marbot pipeline
  • Pitfall: Update pipeline in pipeline

Already a cloudonaut plus subscriber? Watch the full video and join the discussion.

Phased rollout

My last example shows a pipeline excerpt that AWS uses to deploy parts of CodePipeline itself. You can see how new changes are rolled out in phases—starting with a single region to lower the risk.

hased rollout

I used a similar approach in a pipeline to deploy an environment per customer (the application was missing multi-tenant capabilities).

Summary

CodePipeline is the pipeline orchestrator. CodePipeline calls other AWS services to implement a CI/CD pipeline.

Michael Wittig

Michael Wittig

I'm an independent consultant, technical writer, and programming founder. All these activities have to do with AWS. I'm writing this blog and all other projects together with my brother Andreas.

In 2009, we joined the same company as software developers. Three years later, we were looking for a way to deploy our software—an online banking platform—in an agile way. We got excited about the possibilities in the cloud and the DevOps movement. It’s no wonder we ended up migrating the whole infrastructure of Tullius Walden Bank to AWS. This was a first in the finance industry, at least in Germany! Since 2015, we have accelerated the cloud journeys of startups, mid-sized companies, and enterprises. We have penned books like Amazon Web Services in Action and Rapid Docker on AWS, we regularly update our blog, and we are contributing to the Open Source community. Besides running a 2-headed consultancy, we are entrepreneurs building Software-as-a-Service products.

We are available for projects.

You can contact me via Email, Twitter, and LinkedIn.

Briefcase icon
Hire me