Question

Difficulty: MediumAWS CodePipeline

An operations engineer is establishing a continuous deployment workflow for a critical microservice. The pipeline is designed to fetch code from a repository, package the application using AWS CodeBuild, create an AWS CloudFormation change set, require manual intervention for approval, and finally execute the change set.

In what chronological order do these events occur during a successful pipeline execution?

  1. 1The Source action detects a commit in the repository, archives the code, and saves the ZIP file to the Amazon S3 artifact store.
  2. 2The Build action downloads the source archive, executes the buildspec commands, and uploads the compiled application package back to the artifact store.
  3. 3A deploy action uses AWS CloudFormation in CREATE_CHANGE_SET mode to generate a proposal of infrastructure modifications.
  4. 4The pipeline execution stops at a Manual Approval action, publishes a message to an Amazon SNS topic, and waits for a decision.
  5. 5A subsequent deploy action uses AWS CloudFormation in EXECUTE_CHANGE_SET mode to apply the proposed changes to the stack.

Answer

The pipeline execution begins with the Source action detecting a commit and uploading the source ZIP file to S3. Next, the Build action downloads this source archive, runs the buildspec, and uploads the compiled package back to S3. Following the build, the first deployment action uses AWS CloudFormation to create a change set. The pipeline then pauses at the Manual Approval action to await user consent. Once approved, the final deployment action executes the CloudFormation change set to update the infrastructure.
The correct chronological sequence starts with the source action retrieving the codebase, followed by CodeBuild compiling and packaging the app. Once packaged, CloudFormation creates a change set so that the proposed infrastructure changes are calculated. The pipeline then pauses at the manual approval stage for verification. Finally, after approval, CloudFormation executes the change set to deploy the resources.

Step-by-Step Solution

1
Trigger pipeline and output source artifact
The Source stage runs, fetching code from the repository and storing it in the Amazon S3 artifact bucket.
AWS CodePipeline requires a source action to pull the source code and produce an input artifact for subsequent stages.
2
Compile and package the application
AWS CodeBuild runs the build stage, compiling code and outputting a packaged application template artifact to S3.
The build stage consumes the source artifact and produces the deployment package required by the deployment actions.
3
Generate the infrastructure change proposal
AWS CloudFormation creates a change set showing what resources will be created, modified, or deleted.
Creating a change set allows developers to review the proposed modifications before they are applied to the live environment.
4
Pause pipeline for manual approval
The pipeline halts transition to the next action, publishes a notification to an SNS topic, and waits for an approval decision.
This manual approval action is configured between the change set creation and execution to enforce gates and human validation.
5
Apply the infrastructure changes
AWS CloudFormation executes the previously created change set, deploying the updates to the stack.
After the manual approval action is approved, the execution resumes and applies the change set.

Key Concept

AWS CodePipeline execution flow, artifact transition, and integration of CloudFormation change sets with manual approvals.
Rate this question