aws DOP-C02: AWS Certified DevOps Engineer – Professional · Practice questions

Domain 1: SDLC Automation Practice Questions

Review 10 sample questions with their correct answers and explanations. Sign up free to continue with the full topic quiz.

Sign up free for the full quiz

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?

  1. CodeDeploy in-place deployment with the AllAtOnce configuration and the load balancer disabled during deployment
  2. CodeDeploy in-place deployment with the OneAtATime configuration and no load balancer integration in the deployment group
  3. A CloudFormation stack update that replaces the launch template and terminates all old instances at once
  4. 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?

  1. A shared network drive that stores wheel files
  2. AWS CodeArtifact with package origin controls — Correct
  3. Direct installs from the public PyPI on every build
  4. 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?

  1. Ask developers not to merge code outside business hours
  2. Block the stage outside the window (scheduled transitions or Change Calendar) — Correct
  3. Run the production stage only on weekends when traffic is low
  4. 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?

  1. Open inbound port 22 on each on-premises server so that CodeDeploy can push files over SSH
  2. Move the deployment group to an Auto Scaling group that contains the on-premises servers
  3. Register the servers with CodeDeploy using IAM credentials and install the agent — Correct
  4. 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?

  1. A CloudWatch dashboard of security group counts
  2. A Guard, OPA, or Checkov rule in a CodeBuild step — Correct
  3. An AWS Health event for security groups
  4. 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.

Question 6

A company's CI pipeline builds artifacts that must be traceable to their source commit and build environment for supply-chain security. Which practices help? (Choose TWO.)

  1. Sign artifacts in the pipeline and verify signatures before deployment — Correct
  2. Tag artifacts and images with the commit SHA and build ID, and store build provenance metadata — Correct
  3. Reuse the same mutable image tag, such as latest, for every build
  4. Build artifacts on developers' laptops and upload them manually
  5. Delete build logs immediately after each build

Correct answer

Sign artifacts in the pipeline and verify signatures before deployment; Tag artifacts and images with the commit SHA and build ID, and store build provenance metadata

Explanation

Traceable tags, provenance, and signing support supply-chain integrity. Mutable tags, laptop builds, and deleted logs break traceability.

Question 7

A company deploys microservices to EKS with Helm through CodePipeline. It needs the pipeline to authenticate to the cluster with least privilege. Which approach fits BEST?

  1. Open the EKS API endpoint publicly without authentication
  2. EKS access entries mapping the role to namespace-scoped RBAC — Correct
  3. Store a long-lived Kubernetes service account token in the buildspec
  4. Give the CodeBuild role cluster-admin and share the kubeconfig with developers

Correct answer

EKS access entries mapping the role to namespace-scoped RBAC

Explanation

EKS access entries with scoped Kubernetes RBAC give least-privilege access. Cluster-admin, stored tokens, and unauthenticated endpoints are insecure.

Question 8

A company uses a monorepo with 20 microservices. A commit to one service currently triggers builds and deployments of all services. The team wants only the changed service's pipeline to run. Which approach fits BEST?

  1. Create one large pipeline that builds all 20 services in parallel on every commit to save time
  2. Ask developers to disable the pipelines of services that they did not change before each commit
  3. Use CodePipeline V2 triggers with Git file path filters for each service's pipeline — Correct
  4. Split each microservice into a separate AWS account so that pipelines cannot trigger each other

Correct answer

Use CodePipeline V2 triggers with Git file path filters for each service's pipeline

Explanation

Pipeline V2 triggers can filter by file paths so that only affected pipelines run. Building everything wastes time. Manual disabling is error-prone. Separate accounts do not address source triggers.

Question 9

A company needs to ensure that its infrastructure code for networking and IAM is reviewed by different teams. Which practice fits BEST?

  1. Store networking and IAM code outside version control
  2. Code owners rules requiring networking and security approvals — Correct
  3. Ask teams to review changes after deployment if they have time
  4. Let anyone merge changes to any file once tests pass

Correct answer

Code owners rules requiring networking and security approvals

Explanation

Code owners enforce reviews from responsible teams. Unrestricted merges, after-the-fact reviews, and unversioned code lack control.

Question 10

A deployment introduced a bug, and the team needs to roll back an ECS service to the previous task definition quickly. Which action fits BEST?

  1. Increase the desired count so that more tasks run the new version
  2. Delete the ECS cluster and recreate it from scratch with all services
  3. Update the service to the previous task definition revision — Correct
  4. Restart the ECS container agent on each container instance

Correct answer

Update the service to the previous task definition revision

Explanation

Updating to the previous revision or using built-in rollback restores the working version. Recreating clusters is slow. More tasks spread the bug. Restarting agents does not change versions.

Ready for the full quiz?

Create a free QuizAnalyst account to practice the complete question set and save your progress.

Sign up free for the full quiz