DOP-C02 Resilient Cloud Solutions Practice Question
A company uses Amazon ECS with Fargate for containerized applications. They need to ensure that if a task fails, it is automatically restarted and the application remains available. Which THREE actions should they take? (Choose THREE.)
⚠ Common exam trap
The trap here is that candidates often over-engineer the solution by adding CloudWatch and Lambda (Option D) or confuse EC2 Auto Scaling (Option E) with task-level recovery, when the native ECS service configuration already handles automatic restarts.
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
✓
Configure the ECS service to automatically restart failed tasks.
Amazon ECS services can be configured with a desired task count and a task placement strategy that automatically replaces any failed or stopped tasks. When a task exits unexpectedly, the ECS service scheduler detects the discrepancy between the desired and running count and launches a new task to maintain availability. This is the native mechanism for self-healing in ECS, without requiring external triggers.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Configure the ECS service to automatically restart failed tasks.
Why this is correct
The ECS service scheduler continuously monitors running tasks and compares the current count against the desired count. When a task fails due to container exit, OOM, or health check failure, the service automatically starts a replacement task using the same task definition. This is a built-in control loop that requires no custom scripts or external triggers, and it works identically for Fargate and EC2 launch types.
- ✓
Place tasks across multiple Availability Zones.
Why this is correct
Distributing tasks across multiple Availability Zones is a placement strategy that protects against an entire data-center failure. By specifying subnets from different AZs in the ECS service's VPC configuration and using a spread placement strategy, the service places tasks in at least two AZs. If one AZ becomes unavailable, tasks in the remaining AZs continue to serve traffic, and the service scheduler will eventually restore task count in surviving AZs.
- ✓
Use an Application Load Balancer with health checks.
Why this is correct
An Application Load Balancer performs Layer-7 health checks on HTTP endpoints (e.g., /health) and automatically stops sending requests to any task that returns a non-2xx response or times out. This complements ECS's own task restart logic: ALB health checks validate application readiness and handle stuck or slow-start instances, while ECS handles container-level crashes. The ALB also integrates with dynamic port mapping so each task instance gets its own port and is registered as a target.
- ✗
Set up a CloudWatch alarm to trigger AWS Lambda to restart tasks.
Why it's wrong here
Setting up a CloudWatch alarm that triggers a Lambda function to restart ECS tasks is a redundant and custom failure-recovery mechanism. ECS already has built-in auto-restart at the service level; when a task stops, the service immediately starts a replacement. Adding a Lambda introduces execution time lag, IAM permission overhead, and an additional failure point, and it does not handle cases like the task stopping before the alarm fires. ECS service recovery is both faster and simpler.
- ✗
Configure an EC2 Auto Scaling group for the ECS cluster.
Why it's wrong here
An EC2 Auto Scaling group manages the number of EC2 instances, which is applicable only to the EC2 launch type where you must provision and manage container hosts. Fargate does not expose any underlying EC2 instances; instead, ECS runs each task on an isolated, serverless infrastructure managed by AWS. Therefore, configuring an ASG for the cluster is both unnecessary and impossible for Fargate tasks; capacity scaling should instead be done by adjusting the service's desired task count or using ECS Service Auto Scaling.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,298 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on DOP-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 runs a critical microservices architecture on Amazon ECS with Fargate. They want to ensure that if a task fails, it is automatically restarted, and the service remains available across multiple Availability Zones. How should they configure the ECS service?
hard- A.Place all tasks in the same Availability Zone to reduce latency
- B.Run a standalone Fargate task and use a CloudWatch alarm to restart it
- C.Use an EC2 launch type with a single instance to reduce complexity
- ✓ D.Define an ECS service with a task definition, set desired count across multiple Availability Zones, and use Service Auto Scaling
Why D: An ECS service configured with a task definition, desired count across multiple Availability Zones, and Service Auto Scaling ensures resilience. The ECS service scheduler automatically restarts failed tasks, and distributing tasks across AZs provides high availability. Option A is wrong because placing all tasks in a single AZ creates a single point of failure. Option B is wrong because a standalone Fargate task does not have automatic restart; a CloudWatch alarm can restart it but lacks the built-in resilience of an ECS service. Option C is wrong because using a single EC2 instance is a single point of failure and does not provide multi-AZ resilience.
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.