SDLC Automation

Domain 1: SDLC Automation

51 practice questions for Domain 1 of the AWS Certified DevOps Engineer - Professional (DOP-C02) exam, which makes up 22% of its scored content. Your answers count towards one score and one timer for the whole exam.

Domain 1: SDLC Automation

22% of scored content · 51 practice questions

1. A pipeline in a tooling account must deploy into production, staging, and development accounts. Which solution meets these requirements?

Answer and explanation

Answer: B. A cross-account role assumed by the pipeline issues temporary credentials scoped to deployment, and the target accounts also need decrypt permission on the key protecting the artifact bucket or the deployment fails. Long-term keys are a standing credential to manage. Duplicated pipelines multiply maintenance. Administrator access grants far more than deployment requires.

2. A build must retrieve a third-party token without the value appearing in the build log. Which solution meets these requirements?

Answer and explanation

Answer: A. Referencing a secret by type causes the build service to resolve it at run time and mask it in log output. A plaintext environment variable is visible to anyone who can describe the project. Command line arguments commonly appear in logs. An encrypted file in the repository still requires a key and the decrypted value can be echoed.

3. A monorepo builds five services, and only the service whose files changed should be built and deployed. Which solution meets these requirements?

Answer and explanation

Answer: D. Path-based change detection runs only the affected service's actions, which is the standard monorepo approach. Rebuilding everything wastes time and widens the blast radius. Splitting the repository is a large change that may not suit the team. A nightly schedule delays feedback and still builds everything.

4. Builds have slowed because each run downloads the same dependency set from scratch. Which solution meets these requirements?

Answer and explanation

Answer: C. Caching preserves the dependency directory between builds so the download is skipped, which addresses the stated cause. A larger compute type downloads faster without avoiding the download. Running in a VPC often slows external downloads. Splitting duplicates the same download in both halves.

5. Deployments to production must be blocked outside an agreed change window. Which solution meets these requirements?

Answer and explanation

Answer: D. Controlling the stage transition blocks promotion outside the window while earlier stages continue running. A runbook note relies on people. A time-based service control policy denying all actions would break running workloads rather than only deployments. An alarm reports deployments after they have happened.

6. A pull request must trigger the full test suite automatically, with the result visible to reviewers before merge. Which solution meets these requirements?

Answer and explanation

Answer: D. Triggering on pull request events and reporting the result gives reviewers the test outcome before merge. A nightly run gives feedback long after the change was proposed. Local runs are inconsistent between reviewers. Testing after merge means broken code is already on the main branch.

7. A pipeline must run a load test against a deployed environment and fail the stage if latency exceeds an agreed threshold. Which solution meets these requirements?

Answer and explanation

Answer: C. Running the load test as a gating action measures performance before promotion and stops a regression progressing. Testing production after deployment means users experience the regression. Weekly review is retrospective. Oversizing the test environment makes the test unrepresentative.

8. A deployment must be judged successful or failed based on whether the application process started correctly on each instance. Which solution meets these requirements?

Answer and explanation

Answer: A. A non-zero exit from a validation hook marks the instance deployment failed, which is the signal the deployment service acts on. Writing to a log records without deciding. A fixed wait assumes success by default. A system status check reports instance reachability rather than application health.

9. Unit test coverage must be reported on every build and must not fall below an agreed percentage. Which solution meets these requirements?

Answer and explanation

Answer: D. Failing the build on a coverage threshold enforces the standard automatically on every change. Publishing a report relies on someone reading it. Quarterly measurement allows months of decline. A self-declared confirmation is not a measurement.

10. A security scan must run against the application's dependencies and block promotion when a critical vulnerability is found. Which solution meets these requirements?

Answer and explanation

Answer: C. Scanning in the pipeline with a gate stops a vulnerable dependency reaching any environment. A quarterly scan leaves months of exposure. Scanning production means the vulnerability is already deployed. A coding standard relies on developers recognising a vulnerable version.

11. An internal library must be published so other teams consume it with standard package tooling, with access controlled by IAM. Which solution meets these requirements?

Answer and explanation

Answer: D. CodeArtifact hosts language package repositories with IAM-based access and upstream proxying to public registries. A hand-built S3 index lacks package manager integration and metadata handling. ECR stores container images rather than language packages. Committing built artifacts into consumer repositories guarantees version drift.

12. A hardened machine image must be produced monthly through a repeatable, testable process. Which solution meets these requirements?

Answer and explanation

Answer: D. Image Builder runs build and test components on a schedule and distributes the resulting image, which makes the process repeatable and testable. Manual hardening is inconsistent. Patching running instances does not produce an image. A script that engineers run relies on them running it correctly.

13. An artifact promoted from staging to production must be the same artifact that was tested. Which practice meets these requirements?

Answer and explanation

Answer: B. Dependency resolution, tooling versions, and timestamps can all differ between runs, so a rebuild is not guaranteed to reproduce the tested artifact. Rebuilding from the same commit or Dockerfile has the same problem. Comparing checksums after deployment detects a difference only once production is running the new artifact.

14. An AWS Lambda deployment must shift ten percent of traffic for five minutes, then complete, rolling back automatically on elevated errors. Which solution meets these requirements?

Answer and explanation

Answer: C. Canary shifts a fixed percentage, holds for the configured interval, then completes, and an alarm on the deployment group triggers automatic rollback. Linear shifts repeatedly in equal increments rather than one hold-then-complete step. All-at-once exposes every invocation immediately. Load balancer blue/green applies to instance and container targets.

15. An Amazon ECS blue/green deployment must let the team exercise the replacement task set on a separate port before production traffic shifts. Which solution meets these requirements?

Answer and explanation

Answer: C. A test listener exposes the replacement task set on a separate port so it can be exercised before any production traffic shifts, gated by a validation hook. A pipeline approval pauses without providing a test endpoint. A canary shifts real traffic immediately. An after-allow-traffic hook runs once production traffic is already flowing.

16. A deployment must replace instances entirely rather than updating software in place, so a failed release can be discarded. Which deployment pattern meets these requirements?

Answer and explanation

Answer: C. Immutable deployment launches new instances and discards them on failure, so no instance is ever partially updated. Mutable and rolling patterns both modify existing instances, which is what makes a failed release hard to reverse. All-at-once updates every instance simultaneously with no separate environment to discard.

17. A deployment to Amazon EC2 fails on some instances with an error indicating the deployment agent is unreachable. Which cause should be investigated first?

Answer and explanation

Answer: A. An agent unreachable error points to the agent itself being absent, stopped, or lacking permission to communicate. A configuration syntax error would fail during a lifecycle hook rather than at agent contact. Health check timing affects traffic routing. An expired artifact produces a retrieval error rather than an agent error.

18. A pipeline must build once and deploy the same artifact to three environments. Which structure meets these requirements?

Answer and explanation

Answer: D. Building once and promoting the same artifact guarantees production runs what was tested. Per-environment builds may resolve dependencies differently. Environment-specific artifacts are by definition not the artifact that was tested. A manual build is neither repeatable nor auditable.

19. A pipeline stage must be prevented from starting until a security team member approves. Which solution meets these requirements?

Answer and explanation

Answer: C. A manual approval action blocks progression until an authorised principal approves, and IAM restricts who that is. Notifying and continuing removes the gate. Scheduling by availability does not require an approval. Dashboard monitoring depends on someone watching.

20. A build must access a private artifact repository in a VPC. Which configuration is required?

Answer and explanation

Answer: D. Placing the build in the VPC gives it private addressing the repository's security group can permit. Public accessibility exposes the repository. A NAT gateway routes outbound to the internet rather than to a VPC resource. Copying artifacts to S3 first is a workaround that duplicates storage.

21. A team must choose where to store a value that changes per environment and is not sensitive. Which solution is appropriate?

Answer and explanation

Answer: D. Parameter Store holds non-sensitive configuration cheaply and is referenced at run time. Secrets Manager is priced for secrets requiring rotation. A hardcoded value requires a code change per environment. Manually set variables drift between projects.

22. A test suite takes 40 minutes and delays feedback on every commit. Which improvement is appropriate?

Answer and explanation

Answer: B. Splitting by speed gives fast feedback on the common case while preserving full coverage later in the pipeline. A nightly run delays all feedback. Deleting tests loses coverage. A larger compute type helps marginally without changing the structure.

23. An integration test requires a database that must not be shared between concurrent pipeline runs. Which approach is appropriate?

Answer and explanation

Answer: C. An ephemeral per-run database removes contention entirely and guarantees a known starting state. Serialising the pipeline removes concurrency. Shared state with cleanup is fragile when a test fails mid-run. Skipping tests loses coverage precisely when the pipeline is busiest.

24. A pipeline must verify that a deployed environment serves requests correctly before traffic is shifted to it. Which approach is appropriate?

Answer and explanation

Answer: A. A synthetic transaction exercises the application path end to end, which a deployment status cannot. A successful deployment means the artifact was placed. EC2 status checks report instance reachability. A fixed wait assumes success.

25. A pipeline must prevent a commit that lowers code quality below an agreed standard. Which combination of steps meets these requirements? (Select TWO.)

Answer and explanation

Answer: B, D. Static analysis and a coverage threshold both gate the build automatically on measurable criteria. Reviewer judgement varies and does not scale. A monthly dashboard review is retrospective. Post-deployment analysis means the code is already running.

26. Container images must be scanned for vulnerabilities as they are pushed to the registry. Which solution meets these requirements?

Answer and explanation

Answer: A. Enhanced scanning assesses images on push and re-evaluates them as new vulnerabilities are published. Manual scanning does not scale. Scanning production means the vulnerable image is already running. Weekly rebuilds refresh dependencies without detecting what is vulnerable.

27. An artifact repository must retain only the most recent versions of each package to control storage growth. Which approach is appropriate?

Answer and explanation

Answer: D. A retention policy that preserves versions still in use controls growth without breaking a rollback. Age-based deletion may remove a version production still runs. Indefinite retention is the growth problem. Self-service cleanup is inconsistent.

28. An image pipeline must produce images for two processor architectures from one definition. Which approach is appropriate?

Answer and explanation

Answer: A. A manifest list lets one image reference resolve per platform, which is the standard multi-architecture pattern. Emulation costs performance. Separate names push platform selection onto every consumer. Supporting one architecture leaves the other unserved.

29. An Amazon EKS deployment must roll out gradually with automatic rollback if error rates rise. Which approach is appropriate?

Answer and explanation

Answer: A. Progressive delivery shifts traffic incrementally while analysing metrics and reverts automatically on failure. A rolling update replaces pods without metric-based analysis or automatic revert. Deleting and reapplying causes an outage. Scaling to zero does the same.

30. A deployment to Lambda must complete immediately with no traffic shifting, and the team accepts full exposure. Which configuration is appropriate?

Answer and explanation

Answer: A. All-at-once shifts every invocation immediately, which is what the requirement describes. Canary and linear configurations both shift gradually. A test listener applies to load-balanced targets rather than function aliases.

31. A deployment agent on an instance cannot retrieve the application revision from Amazon S3. Which cause should be investigated first?

Answer and explanation

Answer: A. Retrieval failure points to missing object or key permissions on the instance profile. Inbound security group rules do not govern outbound retrieval. Health checks affect traffic routing after deployment. Incorrect tags would mean the instance was not targeted at all rather than failing retrieval.

32. An immutable deployment must be able to revert instantly after traffic has shifted to the new environment. Which approach is appropriate?

Answer and explanation

Answer: D. Retaining the previous environment briefly makes reversion a traffic shift measured in seconds. Immediate termination removes that option. A snapshot or an AMI identifier both require rebuilding, which takes minutes at best.

33. A pipeline's source stage must trigger only when changes land on the main branch. Which configuration is appropriate?

Answer and explanation

Answer: B. A branch filter prevents unwanted executions entirely. Triggering and exiting wastes an execution and obscures the history. A pipeline per branch multiplies maintenance. A schedule decouples the pipeline from the change.

34. A build must fail when a dependency has a known critical vulnerability. Which configuration is appropriate?

Answer and explanation

Answer: C. A non-zero exit fails the build and stops the artifact progressing. Logging records without gating. A weekly external scan leaves a window. Post-release scanning means the vulnerability is already deployed.

35. A pipeline must deploy to production only after a successful deployment to staging. Which structure is appropriate?

Answer and explanation

Answer: A. Sequential stages with validation enforce the dependency. Parallel deployment removes the gate. Reversing the order defeats the purpose. A manually triggered separate pipeline loses the automatic gate.

36. A build project must produce an artifact consumed by a later pipeline stage. Which configuration is required?

Answer and explanation

Answer: A. Declared output artifacts are passed between stages by the pipeline. A hardcoded path bypasses the pipeline's artifact handling. Rebuilding may not reproduce the tested artifact. Email is not a pipeline mechanism.

37. A test suite must run against several runtime versions in parallel within one build. Which configuration is appropriate?

Answer and explanation

Answer: B. A batch build matrix runs combinations in parallel within one project. Sequential execution is slower. Separate projects multiply configuration. Testing one version leaves the others unverified.

38. A pipeline must verify that a deployed API returns correct responses before promoting the release. Which test type is appropriate?

Answer and explanation

Answer: A. Integration tests exercise the deployed endpoints. Unit tests and static analysis run before deployment on code rather than the running service. A load test measures capacity rather than correctness.

39. Test reports from a build must be visible in the build history rather than only in the log output. Which configuration is appropriate?

Answer and explanation

Answer: A. A declared reports section parses result files into the build's report history. Standard output leaves them in the log. Manual upload and email are outside the build's reporting.

40. An ECR repository must prevent an image tag from being overwritten once pushed. Which configuration is appropriate?

Answer and explanation

Answer: C. Tag immutability prevents reassigning an existing tag, which is what makes a tag a reliable reference. A policy denying push blocks all pushes. Scanning assesses content. Lifecycle policies expire images.

41. A CodeArtifact repository must serve both internal packages and packages from a public registry. Which configuration is appropriate?

Answer and explanation

Answer: C. An upstream external connection proxies the public registry through one endpoint with caching. Two repositories require two configurations. Manual copying does not scale. Vendoring bloats the repository.

42. An EC2 Image Builder pipeline must verify that the produced image boots and passes checks before distribution. Which configuration is appropriate?

Answer and explanation

Answer: D. Test components validate the image before distribution. Testing after distribution means a faulty image has already shipped. Manual testing is inconsistent. A successful build does not prove the image boots correctly.

43. A CodeDeploy deployment to Lambda must run a validation before traffic shifts and another after it completes. Which hooks are appropriate?

Answer and explanation

Answer: A. Lambda deployments use BeforeAllowTraffic and AfterAllowTraffic hooks around the traffic shift. The install and application lifecycle hooks apply to EC2 and on-premises deployments.

44. An EC2 deployment must keep the fleet at full capacity throughout a rolling update. Which configuration is appropriate?

Answer and explanation

Answer: C. Adding before removing preserves capacity throughout. Replacing half reduces capacity by half. All-at-once takes the fleet down. Reducing capacity first deliberately lowers it.

45. A deployment must be halted automatically if a CloudWatch alarm enters the ALARM state during rollout. Which configuration is appropriate?

Answer and explanation

Answer: D. An alarm associated with the deployment group triggers automatic rollback. Notification requires a person to act. Post-deployment checks are too late. A longer timeout permits the rollout to continue.

46. An ECS blue/green deployment must keep the original task set running for a period after traffic shifts. Which configuration is appropriate?

Answer and explanation

Answer: D. A termination wait time retains the original task set so traffic can be shifted back quickly. Immediate termination, scaling to zero, and deleting the definition all remove the fast rollback path.

47. A pipeline must fail fast when a required environment variable is missing. Which approach is appropriate?

Answer and explanation

Answer: B. Early validation with a non-zero exit fails before expensive stages run. Failing later wastes the build, defaults mask configuration errors, and manual checking depends on a person.

48. A pipeline must be reusable across several applications with different repository sources. Which approach is appropriate?

Answer and explanation

Answer: A. A parameterized template gives one definition instantiated per application. Copies drift, a shared pipeline couples unrelated applications, and console maintenance does not scale.

49. A pipeline must run contract tests confirming a service still satisfies its consumers' expectations. Which placement is appropriate?

Answer and explanation

Answer: D. Contract tests run before promotion prevent a breaking change reaching consumers. Post-production testing means the break already shipped, independent consumer schedules detect late, and internal integration tests do not capture consumer expectations.

50. A flaky test intermittently fails the pipeline without indicating a real defect. Which approach is appropriate?

Answer and explanation

Answer: B. Quarantine with a fix deadline unblocks delivery without permanently losing coverage. Retrying until pass hides real failures, deleting loses coverage without investigation, and a longer timeout does not address flakiness.

51. A pipeline must verify that a deployed infrastructure change produced the intended configuration. Which approach is appropriate?

Answer and explanation

Answer: C. Assertions against actual deployed configuration verify the outcome. Template review checks intent, stack status confirms the operation completed, and console review is manual.