AWS DevOps CI/CD Pipelines 4 — Questions and Answers
Question 1: A company wants to implement canary deployments for an AWS Lambda function through CodeDeploy. Which deployment preference type should they configure?
- Linear
- Canary (Correct answer)
- AllAtOnce
- BlueGreen
Correct answer: Canary
The Canary deployment preference in CodeDeploy shifts a small percentage of traffic to the new Lambda version first, then shifts the remainder after a validation interval.
Question 2: What does the 'transition disabled' state on a CodePipeline stage mean?
- The stage is permanently deleted
- Artifacts cannot pass from the previous stage into this stage until the transition is re-enabled (Correct answer)
- The stage runs in read-only mode
- The stage skips all manual approval actions
Correct answer: Artifacts cannot pass from the previous stage into this stage until the transition is re-enabled
Disabling a stage transition prevents new executions from entering that stage while allowing in-progress executions to complete, useful for freeze windows.
Question 3: A CodeBuild project needs access to resources inside a private VPC. Which configuration is required?
- Assign an Elastic IP to the CodeBuild project
- Configure VPC settings (VPC ID, subnets, security groups) in the CodeBuild project (Correct answer)
- Enable CodeBuild Enhanced Networking mode
- Use AWS Direct Connect for CodeBuild
Correct answer: Configure VPC settings (VPC ID, subnets, security groups) in the CodeBuild project
CodeBuild can be configured with a VPC, subnets, and security groups so build containers are placed inside the VPC and can reach private resources.
Question 4: Which AWS CodePipeline source action type natively supports triggering on a pull request event from a GitHub repository?
- CodeCommit source action
- GitHub version 1 source action using OAuth
- CodeStarSourceConnection action (GitHub version 2) (Correct answer)
- S3 source action with GitHub webhook
Correct answer: CodeStarSourceConnection action (GitHub version 2)
The CodeStarSourceConnection action (GitHub version 2) uses AWS CodeStar Connections and supports pull request triggers as well as push events.
Question 5: A team wants to enforce that unit tests must pass before the Docker image is pushed to ECR in CodeBuild. How should they order the buildspec phases?
- install → build → post_build
- pre_build → build → post_build, with tests in build and push in post_build (Correct answer)
- build → install → post_build
- pre_build → post_build, skipping the build phase
Correct answer: pre_build → build → post_build, with tests in build and push in post_build
Best practice is to run tests in the build phase and push artifacts (like Docker images to ECR) in post_build, so a test failure stops the pipeline before the push.
Question 6: Which resource allows AWS CodeDeploy to identify the set of EC2 instances that should receive a deployment?
- CodeDeploy Deployment Configuration
- CodeDeploy Deployment Group (Correct answer)
- EC2 Launch Template
- AWS Systems Manager Patch Group
Correct answer: CodeDeploy Deployment Group
A CodeDeploy Deployment Group defines the target instances (via tags, Auto Scaling groups, or on-premises instances) for a deployment.
Question 7: A DevOps engineer needs to roll back a failed CodeDeploy deployment on EC2 instances automatically. What setting enables this?
- Enable 'Rollback on alarm' using a CloudWatch alarm in the deployment group
- Configure 'Automatic rollback on deployment failure' in the deployment group settings (Correct answer)
- Set a CloudWatch Events rule to call StopDeployment API
- Create a Lambda hook in AfterInstall to revert changes
Correct answer: Configure 'Automatic rollback on deployment failure' in the deployment group settings
CodeDeploy deployment groups have a built-in automatic rollback option that triggers a new deployment of the last successful revision when a deployment fails.
A company wants to implement canary deployments for an AWS Lambda function through CodeDeploy.
Which deployment preference type should they configure?