DOP-C02 SDLC Automation Practice Question
An organization uses AWS CodePipeline with multiple stages: Source, Build, Test, and Deploy. The Test stage runs integration tests in CodeBuild. Recently, the pipeline failed because the Test stage took longer than expected, causing a pipeline execution timeout. The pipeline has a default timeout of 7 days. What is the MOST efficient way to set a maximum execution time for the Test stage without affecting other stages?
⚠ Common exam trap
Many candidates confuse the pipeline-level execution timeout with stage-level or action-level timeouts, assuming that adjusting the pipeline timeout is the correct way to limit a specific stage, when in fact CodeBuild's own timeout is the precise and efficient mechanism for controlling build duration.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Modify the CodeBuild project's build timeout (e.g., 1 hour) in the buildspec or project configuration.
The CodeBuild project's build timeout setting directly controls the maximum duration a build can run before it is stopped. By setting this timeout to 1 hour in the CodeBuild project configuration or buildspec, the Test stage will automatically fail if it exceeds that limit, without affecting the pipeline's overall timeout or other stages. This is the most efficient and targeted approach, as it leverages a native CodeBuild feature rather than adding external monitoring or changing pipeline-wide settings.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create an AWS Lambda function that stops the pipeline if the Test stage exceeds 1 hour.
Why it's wrong here
A Lambda function that stops the pipeline after the Test stage exceeds one hour is a reactive workaround that adds operational overhead. The Lambda would need custom logic, IAM permissions for codepipeline:StopPipelineExecution, and likely periodic polling; by the time it triggers, the CodeBuild build has already run longer than allowed. Furthermore, stopping the pipeline execution does not terminate the underlying CodeBuild job, so the build may continue consuming compute time and cost even though the stage appears stopped.
- ✗
Set the pipeline execution timeout to 1 hour in the pipeline settings.
Why it's wrong here
The pipeline execution timeout in CodePipeline settings applies to the entire pipeline, not to a single action or stage. Setting it to one hour would cap the total time for all stages combined, so a lengthy Test stage could consume the whole allowance and cause a later Deploy stage, which may legitimately need more than one hour, to fail. This is too broad and doesn't enforce a stage-specific limit on the CodeBuild project.
- ✗
Use Amazon CloudWatch Events to detect when the Test stage runs for more than 1 hour and then stop the pipeline.
Why it's wrong here
Amazon CloudWatch Events (now EventBridge) can detect a run longer than one hour only after the event has happened, making it a reactive mechanism. A rule would need to invoke a target such as Lambda to stop the pipeline, and even then the CodeBuild build itself is not terminated; it would keep running. Unlike a CodeBuild-level timeout, this approach does not provide a hard limit at the source and introduces additional event-rule and permission complexity.
- ✓
Modify the CodeBuild project's build timeout (e.g., 1 hour) in the buildspec or project configuration.
Why this is correct
In the CodeBuild project configuration (or in the buildspec's timeout-in-minutes field), you can set a build timeout that applies specifically to the build used by the Test stage. When the build exceeds the configured timeout, CodeBuild automatically stops the build and the pipeline transitions to Failed, giving a proactive, stage-scoped limit without affecting the Deploy stage. This is the recommended way to prevent a test job from hanging indefinitely because the timeout is enforced by CodeBuild's execution manager.
Go deeper
Related to this question
About these practice questions
This DOP-C02 question is part of Courseiva's 251-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.