Creating a base AMI for the application instances – Rolling Out a CI/CD Pipeline

Let’s start a new session on our Cloud9 IDE before switching to the chapter-5/ directory and using packer to build the AMI:

aws-devops-simplified:~/environment/chapter-5/packer $ packer build ami_build.json

Build ‘amazon-ebs’ finished after 6 minutes 1 second.

==> Wait completed after 6 minutes 1 second

==> Builds finished. The artifacts of successful builds are:

–> amazon-ebs: AMIs were created:

eu-central-1: ami-09cadf1c312a9b12e

As discussed previously, we intentionally excluded the application source code from the AMI creation process in this chapter to demonstrate CodeDeploy’s capabilities.

After the AMI build process completes, we can proceed with stack deployments using CloudFormation. We will deploy three templates in this chapter (in order):

  1. Infrastructure stack: Deploys foundational resources such as VPCs, subnets, route tables, and so on.
  2. Application stack: Builds on top of the infrastructure stack and deploys Auto Scaling groups, a target group, and an Application Load Balancer.
  3. Pipeline stack: Integrates with the application resources to offer an end-to-end CI/CD pipeline for the application developer. Any code change from this point onwards will automatically be rolled out to the EC2 instances.

Note

You might have provisioned the first two stacks as part of the hands-on exercise in Chapter 4, Managing Infrastructure as Code with CloudFormation. If those resources are still available inyour AWS account, you can directly proceed with deploying the pipeline stack.

Inter-stack dependencies are highlighted in Figure 5.3:

Figure 5.3 – Stacks consuming resource identifiers from each other

Let’s proceed with the stack deployments, starting with the bottom layer.

Leave a Comment