DOP-C02 SDLC Automation Practice Question
A company uses AWS CodePipeline to deploy a microservices application to Amazon ECS. The pipeline has a source stage (CodeCommit), a build stage (CodeBuild), and a deploy stage (CodeDeploy). Recently, deployments have been failing intermittently during the deploy stage with the error: 'The service has reached its maximum number of running tasks.' How should a DevOps engineer resolve this issue?
⚠ Common exam trap
It's easy for candidates to confuse ECS service task limits with CodeDeploy deployment limits or auto scaling policies, leading them to choose options that address scaling or concurrency rather than the explicit task count cap on the ECS service itself.
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
✓
Update the ECS service configuration to increase the maximum number of tasks
The error 'The service has reached its maximum number of running tasks' indicates that the ECS service's desired count or maximum tasks (if using a placement constraint) has been hit. Updating the ECS service configuration to increase the maximum number of tasks (or the desired count) allows the deployment to proceed by accommodating the new tasks during a rolling update. This directly resolves the capacity limit that CodeDeploy encounters when trying to launch new tasks.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Increase the memory reservation for the task definition
Why it's wrong here
The error indicates the ECS service has reached its configured maximum number of tasks, not a memory shortage. Adjusting the memory reservation per task affects how many tasks fit on an EC2 instance or the memory allocated to each Fargate task, but it does not change the service's task count ceiling. If anything, reducing memory could allow more placement, but increasing it would only further constrain placement, and it does not address the explicit maximum limit error.
- ✓
Update the ECS service configuration to increase the maximum number of tasks
Why this is correct
This is the direct fix: the ECS service has an explicit maximum task count (specified via the service's `maximumPercent` in deployment configuration or the `MaxTasks` parameter) that is being exceeded. By increasing that maximum, you permit the service to scale out to the required number of running tasks. The error message specifically indicates that the service cannot add more tasks because this limit is hit, so adjusting the maximum resolves the root cause.
- ✗
Configure an Amazon ECS Service Auto Scaling policy to scale out
Why it's wrong here
Service Auto Scaling can change the desired count based on CPU, memory, or custom metrics, but it cannot exceed the service's configured maximum task count. If the service has already reached its maximum, a scale-out policy will fail to increase the desired count further, because the hard limit is enforced. The error you encountered is exactly that scenario, so merely adding a scaling policy does not address the underlying limit and may also introduce a delay if the metric threshold isn't crossed.
- ✗
Increase the number of concurrent deployments allowed in CodeDeploy
Why it's wrong here
CodeDeploy orchestrates deployments and tracks deployment progress, but it does not enforce a limit on the number of running tasks in an ECS service. The maximum task count is a property of the ECS service definition (or capacity provider), and CodeDeploy's own concurrency limit only controls how many deployments can run simultaneously across your AWS account or region. Increasing that concurrency would have no impact on the ECS service's running task cap, so this option is irrelevant to the error.
Visual reference
Go deeper
Related to this question
About these practice questions
One of 251 original DOP-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 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.