DOP-C02 Question 314
Single answerYour team is managing an application hosted on Amazon ECS using the Fargate launch type. Recently, the application experienced performance degradation during high traffic periods, and your team identified that the containerized application needs more CPU and memory resources during peak load times. To address this, you want to implement an automated solution to adjust the task resource allocation dynamically based on traffic patterns. Which approach should you take?
- A
Configure an ECS Service Auto Scaling policy based on the CPU and memory utilization metrics from Amazon CloudWatch.
- B
Use AWS Lambda to automatically update the task definition with higher CPU and memory values during peak traffic.
- C
Modify the ECS cluster's instance type to provide more CPU and memory resources to the tasks.
- D
Implement an Application Load Balancer (ALB) to distribute traffic evenly across tasks, avoiding resource saturation.
Show answer and explanation
Correct answer: A
Explanation
The best practice for addressing resource scaling in ECS with Fargate is to use ECS Service Auto Scaling. This approach utilizes CloudWatch metrics to dynamically adjust the number of tasks in a service, ensuring optimal resource utilization and application performance during traffic fluctuations. Other options, such as manually modifying task definitions or relying on an ALB, do not address the dynamic scaling requirements effectively.
- A. Correct.
This is the correct answer. ECS Service Auto Scaling policies can automatically adjust the desired count of tasks in a service based on CloudWatch metrics, such as CPU or memory utilization. This ensures that tasks scale up or down dynamically based on application demand.
- B. Incorrect.
This is incorrect. While AWS Lambda could theoretically be used to update task definitions, this approach is not efficient or recommended for addressing real-time resource scaling needs.
- C. Incorrect.
This is incorrect. Modifying the ECS cluster's instance type is not relevant in the context of Fargate, as Fargate abstracts the underlying infrastructure, and resource allocation is defined at the task level.
- D. Incorrect.
This is incorrect. While an ALB can help distribute traffic, it does not dynamically adjust task resource allocations or scale the number of tasks based on load.