Sample questions with answers and explanations
Question 1
A company uses AWS CodePipeline to deploy a web application to EC2 instances in an Auto Scaling group behind an ALB. The company wants zero-downtime deployments, the ability to test the new version before shifting traffic, and an instant rollback path. Which deployment approach meets these requirements?
- CodeDeploy in-place deployment with the AllAtOnce configuration and the load balancer disabled during deployment
- CodeDeploy in-place deployment with the OneAtATime configuration and no load balancer integration in the deployment group
- A CloudFormation stack update that replaces the launch template and terminates all old instances at once
- CodeDeploy blue/green with automatic Auto Scaling group copy and traffic rerouting behind the ALB — Correct
Correct answer
CodeDeploy blue/green with automatic Auto Scaling group copy and traffic rerouting behind the ALB
Explanation
Blue/green creates a replacement fleet, allows testing before traffic shifts, and keeps the original fleet for fast rollback. In-place deployments update existing instances. Replacing all instances at once causes downtime.
Question 2
A company's application uses an internal Python package. Builds must use only approved package versions from a private repository. Which approach fits BEST?
- A shared network drive that stores wheel files
- AWS CodeArtifact with package origin controls — Correct
- Direct installs from the public PyPI on every build
- Packages copied into each developer's home directory
Correct answer
AWS CodeArtifact with package origin controls
Explanation
CodeArtifact with origin controls restricts which versions and sources are allowed. Public installs, home directories, and network drives do not control versions.
Question 3
A company wants to ensure deployments to production happen only during business hours on weekdays. Which approach fits BEST?
- Ask developers not to merge code outside business hours
- Block the stage outside the window (scheduled transitions or Change Calendar) — Correct
- Run the production stage only on weekends when traffic is low
- Delete the production stage every evening and recreate it in the morning
Correct answer
Block the stage outside the window (scheduled transitions or Change Calendar)
Explanation
Scheduled stage transitions or a Change Calendar check enforce windows. Asking developers is not enforcement. Deleting stages is disruptive. Weekend deployment contradicts the requirement.
Question 4
A team deploys to EC2 instances on premises and in AWS with CodeDeploy. Some on-premises deployments fail with errors that the CodeDeploy agent cannot authenticate. Which configuration is required for on-premises instances?
- Open inbound port 22 on each on-premises server so that CodeDeploy can push files over SSH
- Move the deployment group to an Auto Scaling group that contains the on-premises servers
- Register the servers with CodeDeploy using IAM credentials and install the agent — Correct
- Attach an EC2 instance profile to each on-premises server through the CodeDeploy console
Correct answer
Register the servers with CodeDeploy using IAM credentials and install the agent
Explanation
On-premises instances must be registered with credentials (an IAM session or user) and run the agent. Instance profiles exist only for EC2. CodeDeploy does not use SSH. Auto Scaling groups cannot contain on-premises servers.
Question 5
A team wants a security check in its pipeline that fails if the IaC changes would open security groups to 0.0.0.0/0 on ports other than 443. Which tool fits BEST?
- A CloudWatch dashboard of security group counts
- A Guard, OPA, or Checkov rule in a CodeBuild step — Correct
- An AWS Health event for security groups
- An AWS Budgets alert on EC2 spending
Correct answer
A Guard, OPA, or Checkov rule in a CodeBuild step
Explanation
Policy-as-code rules in CI block risky changes. Budgets, dashboards, and Health events do not inspect IaC.