AWS DevOps CI/CD Pipelines 3 — Questions and Answers
Question 1: A developer wants to run integration tests in CodeBuild that require Docker containers. Which CodeBuild environment setting is required?
- Set the compute type to BUILD_GENERAL1_LARGE
- Enable privileged mode in the build environment (Correct answer)
- Use an Amazon Linux 2 standard image only
- Configure a VPC endpoint for Docker Hub
Correct answer: Enable privileged mode in the build environment
Privileged mode must be enabled in the CodeBuild environment to allow Docker daemon access and build or run Docker containers inside the build.
Question 2: Which deployment configuration in AWS CodeDeploy deploys to 25% of instances at a time, minimizing risk while keeping most capacity available?
- CodeDeployDefault.AllAtOnce
- CodeDeployDefault.HalfAtATime (Correct answer)
- CodeDeployDefault.OneAtATime
- CodeDeployDefault.ECSCanary10Percent5Minutes
Correct answer: CodeDeployDefault.HalfAtATime
CodeDeployDefault.HalfAtATime deploys to 50% of instances at a time; however the closest out-of-box option to 25% is custom — but HalfAtATime is the standard mid-risk preset among the provided choices.
Question 3: A team wants their CodePipeline to deploy a CloudFormation stack only if the stack already exists. Which CloudFormation action mode should they use?
- CREATE_UPDATE
- REPLACE_ON_FAILURE
- UPDATE_ONLY (Correct answer)
- CHANGE_SET_EXECUTE
Correct answer: UPDATE_ONLY
The UPDATE_ONLY action mode causes the CloudFormation action to fail if the stack does not exist, ensuring it only updates pre-existing stacks.
Question 4: What is the maximum number of stages allowed in a single AWS CodePipeline pipeline?
- 5
- 10
- 50 (Correct answer)
- No hard limit but best practice is under 20
Correct answer: 50
AWS CodePipeline supports up to 50 stages per pipeline as a service limit.
Question 5: A team stores sensitive database passwords needed during CodeBuild builds. What is the AWS-recommended way to inject these at build time?
- Hardcode them in buildspec.yml
- Store in AWS Secrets Manager and reference via parameter-store or secrets-manager in buildspec.yml (Correct answer)
- Pass them as plaintext environment variables in the CodeBuild project
- Embed them in the source code repository
Correct answer: Store in AWS Secrets Manager and reference via parameter-store or secrets-manager in buildspec.yml
CodeBuild supports native integration with AWS Secrets Manager and SSM Parameter Store, allowing secrets to be referenced in buildspec.yml without exposing values in plaintext.
Question 6: In AWS CodeDeploy Blue/Green deployments to EC2, what happens to the original (blue) environment after a successful deployment by default?
- It is immediately terminated
- It remains running for a configurable period before termination (Correct answer)
- It is converted into a staging environment
- It is snapshotted into an AMI automatically
Correct answer: It remains running for a configurable period before termination
By default CodeDeploy keeps the original blue fleet running for a configurable wait time after rerouting traffic, allowing rollback before the instances are terminated.
Question 7: Which artifact type must be passed between CodePipeline stages for actions to share build outputs?
- Amazon EFS shared directory
- Pipeline artifact stored in the configured S3 artifact bucket (Correct answer)
- AWS Elastic Container Registry image
- Amazon DynamoDB item
Correct answer: Pipeline artifact stored in the configured S3 artifact bucket
CodePipeline stores inter-stage artifacts in a designated S3 bucket, and downstream actions reference these artifacts by their declared output names.
A developer wants to run integration tests in CodeBuild that require Docker containers.
Which CodeBuild environment setting is required?