Correct Answer – A
In this scenario, the SQS queue is used to store the object details, which is a highly scalable and reliable service. ECS is ideal for performing batch processing, and it should scale up or down based on the number of messages in the queue.
If you use a target tracking scaling policy based on a custom Amazon SQS queue metric, dynamic scaling can adjust to the demand curve of your application more effectively.
Option A is CORRECT: Users can configure a CloudWatch alarm based on the number of messages in the SQS queue and notify the ECS cluster to scale up or down using the alarm.
Option B is incorrect: Because the memory usage may not be able to reflect the workload.
Option C is incorrect: Because the number of objects in S3 cannot determine if the ECS cluster should change its capacity.
Option D is incorrect: Because the number of containers cannot be used as a metric to trigger an auto-scaling event.
An Auto Scaling group to manage EC2 instances for the purposes of processing messages from an SQS queue.
A custom metric to send to Amazon CloudWatch that measures the number of messages in the queue per EC2 instance in the Auto Scaling group.
A target tracking policy that configures your Auto Scaling group to scale based on the custom metric and a set target value. CloudWatch alarms invoke the scaling policy.
For details, please check
https://github.com/aws-samples/ecs-refarch-batch-processing.