Courseiva
Design for New Solutions →mediumMultiple Choice

SAP-C02 Design for New Solutions Practice Question

A company is designing a CI/CD pipeline for a containerized application using AWS CodePipeline. The application is deployed to Amazon ECS with Fargate. The pipeline must automatically build and test code changes before deploying to production. Which service should be used to build and test the Docker images?

⚠ Common exam trap

Candidates often confuse AWS CodeDeploy's role in ECS deployments with the build and test phase, assuming CodeDeploy handles the entire CI/CD process, when in fact it only handles the deployment step after the image is built and tested by CodeBuild.

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 service because it is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy. In this scenario, CodeBuild can build the Docker image from a Dockerfile, run unit or integration tests inside the build environment, and then push the image to Amazon ECR, all within the CI/CD pipeline defined in AWS CodePipeline.

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 automates application deployment to targets such as EC2, Lambda or ECS, but performs no build or test steps, so it cannot produce or validate Docker images. It would be correct for the release stage after images are built and tested.

  • ✓

    AWS CodeBuild

    Why this is correct

    CodeBuild is the managed build service that natively integrates with CodePipeline, compiling code and running tests inside Docker containers. It produces the tested image artefact the pipeline then deploys to ECS Fargate, satisfying the requirement to build and test before production release.

  • ✗

    Amazon ECR

    Why it's wrong here

    Amazon ECR stores and serves container images; it cannot execute builds or run tests. It is tempting because the pipeline must push images somewhere, and ECR is that destination, but CodeBuild performs the actual build-and-test step the stem requires.

  • ✗

    AWS CodeCommit

    Why it's wrong here

    CodeCommit is a managed Git repository for storing source, not a build or test engine, so it cannot compile code or run Docker image tests. It would be the right choice for hosting and versioning the pipeline's source code.

About these practice questions

This SAP-C02 question is part of Courseiva's 984-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 →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on SAP-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. 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?

medium
  • A.AWS CodeDeploy
  • B.AWS CodeCommit
  • C.Amazon ECS
  • ✓ D.AWS CodeBuild

Why D: 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.

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.