SAP-C02 Continuous Improvement for Existing Solutions Practice Question
A company uses AWS CodePipeline to automate deployments of a microservices application to Amazon ECS. The pipeline builds a Docker image, pushes it to Amazon ECR, and updates the ECS service. Recently, deployments have failed because insufficient IAM permissions cause the pipeline to fail when updating the ECS service. The development team wants to implement least privilege permissions. Which IAM policy statement should be added to the CodePipeline service role to allow it to update the ECS service?
⚠ Common exam trap
Candidates often confuse the permissions needed for different stages of the pipeline (e.g., pushing to ECR or registering a task definition) with the specific permission required to update the ECS service, leading them to select options that are valid for other actions but not for the failing step.
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
✓
{"Effect":"Allow","Action":["ecs:UpdateService"],"Resource":"*"}
The CodePipeline service role needs the ecs:UpdateService permission to trigger an ECS service update after a new Docker image is pushed to Amazon ECR. This action allows the pipeline to instruct ECS to redeploy the service using the updated task definition, which is the specific step that was failing due to insufficient permissions. The resource wildcard is acceptable here because the pipeline role is scoped by the pipeline's own trust policy and resource-based policies on the ECS service.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
{"Effect":"Allow","Action":["ecs:UpdateService"],"Resource":"*"}
Why this is correct
UpdateService is the action needed to update the ECS service.
- ✗
{"Effect":"Allow","Action":["ecr:PutImage"],"Resource":"*"}
Why it's wrong here
PutImage is for ECR, not ECS service update.
- ✗
{"Effect":"Allow","Action":["ecs:RunTask"],"Resource":"*"}
Why it's wrong here
RunTask starts a task, not updates a service.
- ✗
{"Effect":"Allow","Action":["ecs:RegisterTaskDefinition"],"Resource":"*"}
Why it's wrong here
RegisterTaskDefinition is for registering task definitions, not updating services.
Go deeper
Related to this question
About these practice questions
One of 1,660 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.