DVA-C02 - Deployment - Section 3.6

Automate build, test and deployment using AWS CodePipeline and AWS CodeBuild with commit-triggered actions and manual approvals.

Automate build, test, and deployment workflows with AWS CodePipeline orchestrating stages that invoke AWS CodeBuild using a buildspec file. Insert manual approval actions between stages to gate production deployments and configure pipeline transitions to halt or resume flow based on test outcomes.

AWS CodePipelineAWS CodeBuildManual approval actionsbuildspec

Practice question for this objective

Free sampleDeploymentmedium

A development team uses AWS CodeBuild to compile a Node.js service and run its unit tests. The team wants the dependency install to happen first, the unit tests to run only after a successful install, and the compiled output to be packaged for the next pipeline stage. In which sequence of buildspec phases should the team place these commands so CodeBuild runs them in the intended order?

  • APut the dependency install in the build phase, run the unit tests in the install phase, and package the output in the pre_build phase of the buildspec file.
  • BPut the dependency install in the install phase, run the unit tests in the build phase, and package the compiled output in the post_build phase of the buildspec file. Correct
  • CPut the dependency install in the post_build phase, run the unit tests in the pre_build phase, and package the compiled output in the install phase of the buildspec file.
  • DPut all three commands in a single pre_build phase and rely on CodeBuild to reorder them by dependency so install, tests, and packaging each run correctly.
Map build steps to the fixed CodeBuild buildspec phase order of install, pre_build, build, and post_build to control execution sequence. CodeBuild always runs buildspec phases in the order install, pre_build, build, then post_build, and within each phase commands run top to bottom; placing install, tests, and packaging in successive phases enforces the ordering rather than relying on any automatic dependency resolution.

Why A is wrong: This inverts the phase order, because install runs before pre_build and build, so placing tests in install would run them before dependencies are even fetched.

Why B is correct: CodeBuild executes install, then pre_build, then build, then post_build in that fixed order, so this mapping runs the steps exactly as the team intends.

Why C is wrong: This is tempting if phase names are read loosely, but post_build runs last, so installing dependencies there would happen after tests had already failed.

Why D is wrong: CodeBuild runs commands in the literal order written and does not reorder them by dependency, so collapsing every step into one phase gives no guaranteed sequencing.

See more DVA-C02 practice questions, answers explained.

More in this domain

Back to all Deployment objectives, or the DVA-C02 cert hub.

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