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!


Looking for a new challenge?

  • tecRacer

    Cloud Consultant • AWS DevOps

    tecRacer • Premier AWS Consulting Partner • Germany, Austria, Portugal, and Switzerland
    Infrastructure as Code Container Continuous Deployment
  • DEMICON

    Senior Lead Cloud Solutions Architect AWS

    DEMICON • AWS Advanced Consulting Partner • Remote (Europe)
    GitLab Terraform K8s EKS Lambda Python Go

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

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.

Become a cloudonaut supporter

Michael Wittig

Michael Wittig ( Email Twitter LinkedIn Mastodon )

We launched the cloudonaut blog in 2015. Since then, we have published 366 articles, 60 podcast episodes, and 58 videos. It's all free and means a lot of work in our spare time. We enjoy sharing our AWS knowledge with you.

Please support us

Have you learned something new by reading, listening, or watching our content? With your help, we can spend enough time to keep publishing great content in the future. Learn more

$
Amount must be a multriply of 5. E.g, 5, 10, 15.

Thanks to Alan Leech, Alex DeBrie, ANTHONY RAITI, Christopher Hipwell, e9e4e5f0faef, Jason Yorty, Jeff Finley, jhoadley, Johannes Grumböck, Johannes Konings, John Culkin, Jonas Mellquist, Jonathan Deamer, Juraj Martinka, Ken Snyder, Markus Ellers, Oriol Rodriguez, Ross Mohan, Ross Mohan, sam onaga, Satyendra Sharma, Simon Devlin, Thorsten Hoeger, Todd Valentine, Victor Grenu, waldensystems, and all anonymous supporters for your help! We also want to thank all supporters who purchased a cloudonaut t-shirt.