DOP-C02 domain - 22% of the exam

SDLC Automation

SDLC Automation is 22% of the DOP-C02 exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

61
Practice questions
7
Objectives
36
Medium
25
Hard

Where people go wrong

  • Accepting a stored credential where a short-lived one is required

    The wrong answers keep a long-lived secret and try to make it safer: a personal access token, static IAM access keys, an encrypted copy in Secrets Manager, or a token rotated on a schedule. Encryption and rotation do not change that the credential lives a long time. The correct answers issue credentials per use: an AWS CodeConnections connection for GitHub, a cross-account role assumed through AWS Security Token Service, a CodeArtifact GetAuthorizationToken call at the start of each build, and STS-based registration for on-premises CodeDeploy servers.

    See it in a sample question
  • Fixing a cross-account artifact failure by weakening encryption

    When a cross-account deploy cannot read pipeline artifacts, the wrong answers remove protection: default S3-managed encryption, no encryption at all, a public bucket, an administrator policy, or collapsing the accounts. The failure is a missing grant. With a customer managed AWS KMS key, the production deploy role needs decrypt permission in the key policy and read permission on the bucket, and the pipeline assumes that role. An AWS managed key cannot have its key policy edited for cross-account use.

    See it in a sample question
  • Expecting an in-place deployment to give an instant rollback

    The wrong answers try to make an in-place CodeDeploy deployment safer: smaller batches, a validation hook, automatic rollback, or a higher minimum healthy hosts value. Each still installs over the running instances, so a bad build has already replaced the original code and recovery means redeploying the previous revision. Blue/green provisions a replacement Auto Scaling group behind the load balancer, shifts traffic after health checks, and leaves the original instances untouched, so reverting is a reroute.

    See it in a sample question
  • Building alarm-driven rollback by hand

    The wrong answers react to a bad release with human or custom steps: a manual approval, an SNS topic feeding a Lambda function, a lifecycle-hook Lambda polling metrics, or an operator watching a dashboard. Rollback on failure alone does not help either, because a release that deploys cleanly but runs slowly reports success. CodeDeploy monitors a CloudWatch alarm directly. With the alarm associated with the deployment group, or listed in the Alarms property of a SAM DeploymentPreference, CodeDeploy reverts to the previous version or task set itself.

    See it in a sample question
  • Confusing linear and canary traffic shifting

    In the canary scenarios, linear shifting and AllAtOnce are the wrong options. Linear moves traffic in equal increments on a timer, so it never holds one small slice for an observation window, and AllAtOnce moves every request in one step. A canary configuration sends a fixed small percentage first, waits while alarms watch real traffic, then shifts the remainder in one step. Some wrong options keep the canary shape but change the hold time, so the configuration must match both the percentage and the interval.

    See it in a sample question

Objectives in this domain

What to study

The official documents this domain's practice questions cite most.

Sample questions from this domain

Free sampleSDLC Automationmedium

An integration-test stage needs short-lived credentials to call AWS APIs in a separate test account during the run, and the security team forbids storing any long-lived access keys in the pipeline. The build runs in "AWS CodeBuild". What is the most secure way to grant the build access to the test account?

  • AStore an IAM access key pair for a test-account user in "AWS Secrets Manager" and have the build retrieve and export the keys before running the integration tests.
  • BBake a test-account access key and secret into the "CodeBuild" project environment variables so the build can authenticate to the test account during the run.
  • CCreate a permanent IAM user in the test account, attach the needed policies, and place its credentials in an encrypted "Amazon S3" object the build downloads at start.
  • DGive the "CodeBuild" service role permission to assume a cross-account IAM role in the test account, and have the build call "AWS Security Token Service" to get temporary credentials. Correct
Use a CodeBuild role that assumes a cross-account role through STS for short-lived, scoped credentials instead of any stored long-lived keys. Cross-account role assumption through AWS STS issues temporary credentials that expire automatically and carry only the permissions of the assumed role, removing the need to store or rotate any access keys in the pipeline.

Why A is wrong: Encrypting keys in Secrets Manager is better than plaintext but still relies on long-lived credentials, which the security team forbids, so it fails the stated constraint.

Why B is wrong: Plaintext keys in environment variables are long-lived and easily leaked through logs, directly violating the no-long-lived-keys rule, so this is the weakest option.

Why C is wrong: A permanent user with stored credentials in S3 is still long lived and adds rotation burden, so encryption at rest does not satisfy the short-lived-credential requirement.

Why D is correct: Assuming a cross-account role via STS yields short-lived credentials scoped by the role, with no stored keys, satisfying least privilege and the no-long-lived-keys requirement.

Free sampleSDLC Automationmedium

A company runs its AWS CodePipeline in a shared tooling account but deploys the built artifacts into a separate production account using a CloudFormation deploy action. The pipeline currently fails at the deploy stage with an access denied error, even though a cross-account IAM role exists in the production account. The team encrypts the pipeline artifact store with a customer managed AWS KMS key. They want the most reliable way to let the production-account role read the artifacts and deploy them. Which change resolves the failure while keeping access scoped?

  • AGrant the production-account deploy role permission to use the customer managed KMS key in the key policy, and allow the tooling-account pipeline role to assume that role, so the role can decrypt and read the artifacts. Correct
  • BReplace the customer managed KMS key on the artifact bucket with the default Amazon S3 managed key, because cross-account CodePipeline actions cannot decrypt artifacts protected by a customer managed key under any configuration.
  • CMake the artifact S3 bucket public-read so the production account can fetch the artifacts directly, then attach an administrator policy to the cross-account role so it has enough permissions to deploy.
  • DMove the entire pipeline into the production account so no cross-account artifact access is needed, then have developers push source directly into that account to avoid configuring any assume-role trust.
For cross-account CodePipeline deploys with a customer managed KMS key, the target role needs both assume-role trust and key-usage rights to decrypt artifacts. When a CodePipeline artifact store uses a customer managed AWS KMS key, any cross-account role that reads those artifacts must be listed as a key user in the key policy in addition to having S3 read access and assume-role trust; without the KMS grant the deploy action gets access denied even though the IAM role exists.

Why A is correct: Cross-account actions fail when the deploy role cannot decrypt the artifacts; adding the role as a key user in the KMS key policy plus the assume-role trust lets it read the encrypted artifact and deploy, with access scoped to that one role.

Why B is wrong: Cross-account decryption with a customer managed key is fully supported once the key policy and bucket grants are correct, so downgrading encryption sacrifices control to fix a problem that is really a missing grant.

Why C is wrong: A public bucket and an administrator policy both breach least privilege and expose build output, and neither addresses the KMS decryption grant that is the actual cause of the access denied error.

Why D is wrong: Collapsing accounts removes the separation the company chose and is a large re-architecture, when the failure is simply a missing KMS key grant on the existing cross-account role.

Free sampleSDLC Automationhard

A retailer releases a customer-facing web application to an Amazon EC2 Auto Scaling group fronted by an Application Load Balancer using AWS CodeDeploy. A recent in-place release served errors to live users and the team had to redeploy the previous revision by hand while customers saw failures. The team now wants each release to stand up a fresh replacement fleet behind the load balancer, and they want any breach of an error-rate threshold during or shortly after cutover to send all traffic back to the untouched original instances automatically. Which TWO actions together meet this requirement? (Select TWO.)

  • AConfigure the CodeDeploy deployment group to use the blue/green deployment type so a new replacement Auto Scaling group is provisioned and registered behind the Application Load Balancer before any production traffic shifts to it. Correct
  • BAssociate a CloudWatch alarm on the target-group error metric with the deployment group and enable automatic rollback when an alarm threshold is breached during the deployment monitoring window. Correct
  • CKeep the in-place deployment type and raise the minimum healthy hosts value so that more original instances stay in service while each instance is updated one batch at a time.
  • DAdd a smoke-test script to the ValidateService lifecycle hook in the AppSpec file so each updated instance is tested before the load balancer sends it production traffic during the release.
A fresh-fleet release with automatic reversion on a live error threshold needs blue/green deployment combined with an alarm-driven automatic rollback. Blue/green in CodeDeploy builds a separate replacement Auto Scaling group, registers it behind the load balancer, and shifts traffic only after it is healthy, keeping the original fleet intact. Pairing the deployment group with a CloudWatch alarm and automatic rollback makes CodeDeploy reroute back to the original instances without an operator the instant the error metric breaches its threshold.

Why A is correct: Blue/green provisions a fresh green fleet behind the load balancer and only shifts traffic after it is ready, which is exactly the fresh-fleet model the scenario demands and leaves the original instances untouched for rollback.

Why B is correct: An alarm-driven rollback makes CodeDeploy reroute traffic back to the original instances on its own the moment the error threshold is breached, which delivers the hands-off reversion the team requires.

Why C is wrong: Raising minimum healthy hosts protects capacity during an in-place rollout, but in-place still mutates the running instances so there is no untouched original fleet to reroute back to, which fails the stated rollback requirement.

Why D is wrong: A ValidateService hook gates an individual instance before it receives traffic, but it does not provision a replacement fleet and does not react to live error metrics after cutover, so on its own it does not satisfy either requirement.

Free sampleSDLC Automationhard

A retailer runs an Amazon EC2 Auto Scaling group behind an Application Load Balancer and deploys with AWS CodeDeploy. After a recent release latency climbed sharply but the deployment itself reported success, so it stayed live until an on-call engineer noticed and reverted it manually thirty minutes later. The team wants future deployments to revert automatically and without human action the moment a defined latency threshold is breached during or shortly after the rollout. Which configuration MOST directly achieves hands-off reversion?

  • AAdd a manual approval action to the pipeline immediately after the CodeDeploy stage so an engineer reviews the latency dashboards and approves or rejects the release before it is considered complete.
  • BCreate an Amazon EventBridge rule on a CodeDeploy deployment-state event that invokes an AWS Lambda function which calls StopDeployment when the team later observes that latency has degraded.
  • CEnable CodeDeploy automatic rollback on deployment failure only, relying on the lifecycle hooks to mark the deployment failed whenever the application reports elevated latency to the host scripts.
  • DConfigure the CodeDeploy deployment group to roll back automatically when a CloudWatch alarm associated with the deployment enters the ALARM state, and base that alarm on the load balancer target latency metric. Correct
Associate a CloudWatch metric alarm with a CodeDeploy deployment group to trigger automatic alarm-driven rollback without manual intervention. CodeDeploy supports automatic rollback both on deployment failure and when a monitored CloudWatch alarm enters ALARM; binding an alarm on load balancer target latency means a clean-but-slow build still trips the alarm and CodeDeploy reverts to the previous revision automatically.

Why A is wrong: A manual approval reinserts the human step the team is trying to remove and only gates promotion; it does not automatically revert a release once latency has already breached the threshold.

Why B is wrong: StopDeployment halts an in-progress deployment but does not revert a finished one, and wiring a bespoke Lambda is more operational overhead than the built-in alarm-based rollback CodeDeploy already offers.

Why C is wrong: Rollback on failure only triggers when a lifecycle event errors; a build that deploys cleanly but runs slow reports success, so latency-driven reversion needs an alarm rather than a failure trigger.

Why D is correct: Associating a CloudWatch alarm on target latency with the deployment group lets CodeDeploy detect the breach and trigger an automatic rollback to the prior revision with no human action required.

Free sampleSDLC Automationhard

A team runs an Amazon ECS service using the CodeDeploy deployment controller for blue/green releases. They want production traffic to move in small increments rather than all at once, sending ten percent of requests to the new task set first, holding for five minutes so CloudWatch alarms can observe real traffic, then shifting the remaining ninety percent if no alarm fires. Which CodeDeploy traffic-shifting configuration matches this requirement?

  • AUse a CodeDeployDefault.ECSLinear10PercentEvery1Minutes deployment configuration so traffic moves in ten-percent increments once a minute until the new task set carries all production requests.
  • BUse a CodeDeployDefault.ECSCanary10Percent5Minutes deployment configuration so ten percent of traffic shifts first, the deployment waits five minutes for alarms, then the remaining traffic shifts in one step. Correct
  • CUse a CodeDeployDefault.ECSAllAtOnce deployment configuration with a five-minute BeforeAllowTraffic hook so validation runs before the full shift, keeping exposure low while alarms watch the release.
  • DUse a CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration so ten percent shifts first and the deployment waits fifteen minutes before shifting the rest, giving alarms a longer window to fire.
Map a two-stage ten-percent-then-rest traffic shift with a five-minute hold to the ECS canary CodeDeploy deployment configuration. CodeDeploy traffic-shifting configurations for Amazon ECS come in canary, linear and all-at-once shapes; a canary shifts one increment, holds for a fixed interval so CloudWatch alarms can observe, then shifts the remainder, so ECSCanary10Percent5Minutes encodes exactly the ten-percent-first, five-minute-hold, then-rest behaviour requested.

Why A is wrong: Linear shifting moves ten percent every minute in many equal steps rather than a single ten-percent canary followed by a five-minute hold, so the described two-stage pattern with one observation window does not match.

Why B is correct: The ECSCanary10Percent5Minutes configuration shifts exactly ten percent first, pauses five minutes so alarms can evaluate live traffic, then moves the rest in a single step, matching the described two-stage canary precisely.

Why C is wrong: AllAtOnce moves every request to the new task set in one step, so no portion of production traffic is held at ten percent for an observation window before the full cutover the team wants.

Why D is wrong: This canary shape is correct in structure but holds for fifteen minutes rather than the five-minute window the requirement specifies, so the alarm observation period does not match the stated design.

Other domains in this exam

See also the DOP-C02 cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by Amazon Web Services. Original, blueprint-aligned practice material only.