Service · Developer Tools
AWS CodeBuild
Run builds, tests and image builds from a buildspec, with secrets, caching and VPC access.
- 1CodeBuild reads the source and the buildspec.
- 2It builds the image and pushes it to ECR.
- 3It saves test reports and artifacts to S3.
Phases
- It holds
- install, pre_build, build, post_build
- Tip
- Log in to ECR in pre_build
Environment
- It holds
- Variables, parameter-store, secrets-manager
- Tip
- Keep secrets out of plain text
Cache
- It holds
- Paths kept between builds
- Tip
- S3 or local cache
Reports and artifacts
- It holds
- Test results and output files
- Tip
- Fail the build on failed tests
Privileged mode
- It holds
- Docker daemon for image builds
- Tip
- Off by default
| Part | It holds | Tip |
|---|---|---|
| Phases | install, pre_build, build, post_build | Log in to ECR in pre_build |
| Environment | Variables, parameter-store, secrets-manager | Keep secrets out of plain text |
| Cache | Paths kept between builds | S3 or local cache |
| Reports and artifacts | Test results and output files | Fail the build on failed tests |
| Privileged mode | Docker daemon for image builds | Off by default |
1 / 2
Phases
- It holds
- install, pre_build, build, post_build
- Tip
- Log in to ECR in pre_build
Environment
- It holds
- Variables, parameter-store, secrets-manager
- Tip
- Keep secrets out of plain text
Cache
- It holds
- Paths kept between builds
- Tip
- S3 or local cache
| Part | It holds | Tip |
|---|---|---|
| Phases | install, pre_build, build, post_build | Log in to ECR in pre_build |
| Environment | Variables, parameter-store, secrets-manager | Keep secrets out of plain text |
| Cache | Paths kept between builds | S3 or local cache |
2 / 2
Reports and artifacts
- It holds
- Test results and output files
- Tip
- Fail the build on failed tests
Privileged mode
- It holds
- Docker daemon for image builds
- Tip
- Off by default
| Part | It holds | Tip |
|---|---|---|
| Reports and artifacts | Test results and output files | Fail the build on failed tests |
| Privileged mode | Docker daemon for image builds | Off by default |
What it is
AWS CodeBuild runs commands in a clean container for each build and charges for build minutes. A buildspec.yml file lists them in phases: install, pre_build, build and post_build. It also names the artifacts to keep, the test reports to publish and the cache paths. Pick a build image, or your own from Amazon ECR, and a compute size. For GPU or large builds choose a bigger type.
What it is
To build a Docker image you must turn on privileged mode, so the Docker daemon can run. In pre_build, log in with aws ecr get-login-password, then build, tag and push the image to Amazon ECR in build and post_build. The service role needs ECR push permissions. Put secrets in the env section with parameter-store or secrets-manager, never in plain variables. A local or S3 cache saves time on repeated downloads.
What it is
To reach private resources, run the build in your VPC. It then needs a NAT gateway or VPC endpoints to reach the internet, ECR or S3. Test reports in JUnit or similar formats show in the console, so a failed unit test fails the build. Common faults: Docker not running (privileged mode off), image push denied (role), and timeouts in a VPC (no route).
Remember
- buildspec.yml phases: install, pre_build, build, post_build.
- Privileged mode is needed to build Docker images.
- Secrets come from Systems Manager Parameter Store or Secrets Manager through the env section.
- Cache paths speed up repeat builds. Reports and artifacts go to S3.
Remember
- In a VPC, a build needs a NAT gateway or endpoints for outside access.
- ECR push needs a login in pre_build and a role that allows it.
On the exam
- “Cannot connect to the Docker daemon in a build” points to privileged mode.
- “Keep a database password out of the buildspec” points to the secrets-manager or parameter-store env section.
- “Build must reach a private repository” points to running the build in a VPC.
- “Run unit tests and fail the build on a failure” points to a CodeBuild test report in the buildspec.
In this task · 3.3
- Deployment strategies and rollback
CodePipeline
CodeBuild
CodeDeploy
SageMaker Pipelines
- Automated testing in ML pipelines
- Triggering retraining
Model Registry
Prompt Management
- Agent deployment pipelines and versions
- AI model and prompt testing
- Automating FM deployment and fine-tuned model versions
- RAG update and knowledge base refresh pipelines
Step Functions