In a CodeBuild buildspec.yml, where do you install dependencies and prepare the build environment before compiling?
A.The post_build phase
post_build is for packaging/pushing after compile.
B.The install phase
Correct. install = environment and dependency setup.
C.The artifacts section
artifacts declares outputs — it's not a phase.
D.The build phase
build runs the actual compile commands.
Why this answer
Buildspec phases run in order: install (run time/env setup — though runtimes usually come from the image) → pre_build (sign-in, install dependencies) → build (compile) → post_build (package, push). Dependency install traditionally sits in install or pre_build — install is the phase name the exam wants.
Correct answer: B · Last reviewed 2026-11-03
Official AWS references
Practice this interactively
Answer without seeing the solution first in the CI/CD & Observability practice session.
Practice CI/CD & Observability