DOP-C02 imagedefinitions.json Practice Question
A DevOps engineer is setting up a CI/CD pipeline for a Node.js application. The application must be built, tested, and deployed to an Amazon ECS cluster. The team wants to use AWS CodeBuild to run unit tests and package the application as a Docker image, and AWS CodePipeline to orchestrate the workflow. Which artifact type should CodeBuild output to be used by a subsequent CodePipeline action?
⚠ Common exam trap
The trap is that candidates may think CodeBuild passes the Docker image itself as an artifact, but in reality, the artifact is a configuration file (imagedefinitions.json) that tells the ECS deploy action which image to use.
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
✓
A JSON file with the image details.
CodePipeline's ECS deploy action requires an input artifact containing an imagedefinitions.json file that specifies the image URI. CodeBuild should produce this JSON file as its output artifact, not merely push the image to ECR. The subsequent deploy action reads the JSON file to determine which image to use, so the correct artifact type is a JSON file with image details.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
A Docker image pushed to Amazon ECR.
Why it's wrong here
Pushing the Docker image to Amazon ECR is a necessary prerequisite but not the output artifact that the ECS deploy action consumes. CodeBuild must also write an image definitions file (imagedefinitions.json) containing the container name and the exact image URI in ECR; the ECS deploy action reads that JSON, not the image itself, to register a new task definition and update the service. Without the JSON mapping, the ECS service has no way to know which image tag corresponds to the new deployment.
- ✗
A zip file containing the application source code.
Why it's wrong here
A zip file containing the application source code is incorrect because the CodePipeline ECS deploy action is not designed to ingest source code or build context. It expects a structured artifact that lists the container name and the ECR image URI so it can prepare the task definition for deployment. A source-code zip contains no image metadata, and even if it included a Dockerfile or buildspec, the deploy action would not inspect or build anything at that stage — it only parses the image details JSON.
- ✗
A tarball stored in Amazon S3.
Why it's wrong here
A tarball stored in Amazon S3 is wrong because the deploy action does not accept arbitrary archives. Even if the tarball contains the source code, a Docker image, or a nested imagedefinitions.json, the ECS deploy action expects the image details JSON to be a standalone artifact in its extracted form, not embedded inside a compressed archive. The platform cannot unpack arbitrary tar files to discover the file, so the deployment would fail or be skipped unless the pipeline first extracts the tarball and republishes the JSON as a separate artifact.
- ✓
A JSON file with the image details.
Why this is correct
This is correct because the ECS deploy action in CodePipeline consumes an image definitions file, typically named imagedefinitions.json, formatted as a JSON array mapping each ECS container name to its image URI (for example, [{"name":"web","imageUri":"123456789012.dkr.ecr.us-east-1.amazonaws.com/my-app:latest"}]). CodeBuild generates this file as a pipeline artifact after pushing the image to ECR, and CodePipeline uses it to create/update the task definition and trigger the deployment. The file must be at the artifact root with the recognized name; any other JSON structure or filename will cause the deploy action to fail.
Go deeper
Related to this question
About these practice questions
This DOP-C02 question is part of Courseiva's 251-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-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 DOP-C02 exam.