SAP-C02 Design for New Solutions Practice Question
A company is designing a new CI/CD pipeline for a containerized application using AWS CodePipeline. The application source code is stored in an Amazon S3 bucket. The pipeline must automatically build a Docker image from the source code and push it to Amazon ECR. Which action should be used as the build provider?
⚠ Common exam trap
Candidates often confuse Amazon ECS (a container runtime service) with a build service, or assume CodeDeploy can handle image building because it supports ECS deployments, but neither service can compile source code or push images to ECR.
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
✓
AWS CodeBuild
AWS CodeBuild is the correct build provider because it is a fully managed continuous integration service that can compile source code, run tests, and produce Docker images. It integrates natively with CodePipeline and Amazon ECR, allowing you to define a buildspec.yml file that uses the 'aws ecr get-login-password' command and 'docker build/push' commands to build and push the image directly to ECR.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
AWS CodeDeploy
Why it's wrong here
CodeDeploy performs deployments to compute targets such as EC2, ECS or Lambda; it does not compile source or build Docker images, so it cannot produce the image for ECR. It is tempting because CodeDeploy is the natural CodePipeline deploy stage — correct when the pipeline must release an already-built artefact.
- ✗
AWS CodeCommit
Why it's wrong here
CodeCommit is a Git source repository, not a build engine; it stores code and cannot execute Docker builds or push images to ECR. It is tempting because CodeCommit is a valid CodePipeline source provider — the right choice when the pipeline's source stage must pull code from a Git repository.
- ✗
Amazon ECS
Why it's wrong here
Amazon ECS deploys and runs containers; it cannot compile source or build Docker images. The build stage needs a provider that executes buildspec commands, so AWS CodeBuild is required here. ECS would be the right choice for the deploy stage, where the pipeline launches the built image as a service or task.
- ✓
AWS CodeBuild
Why this is correct
AWS CodeBuild natively builds Docker images and pushes them to Amazon ECR, satisfying the pipeline's build-and-push requirement. It integrates directly with CodePipeline as a build action, executing buildspec commands that run docker build and docker push against ECR within the pipeline's S3-sourced workflow, without needing external compute or custom orchestration.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
One of 984 original SAP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SAP-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 SAP-C02 exam.