Which solution will meet these requirements?
Use CloudWatch to create a metric math expression to calculate the approximate age of the oldest message in the SQS queue. Create a target tracking scaling policy for the metric math expression to modify the Auto Scaling group.
Use CloudWatch to create a metric math expression to calculate the approximate number of messages visible in the SQS queue for each instance. Create a target tracking scaling policy for the metric math expression to modify the Auto Scaling group.
Create an Application Load Balancer (ALB). Attach the ALB to the Auto Scaling group. Create a target tracking scaling policy for the ALBRequestCountPerTarget metric to modify the Auto Scaling group.
Create an Application Load Balancer (ALB). Attach the ALB to the Auto Scaling group. Create a scheduled scaling policy for the Auto Scaling group.
Explanations:
While calculating the age of the oldest message in the SQS queue can provide insights into processing delays, it does not directly address the need to scale instances based on the volume of messages being processed. Target tracking based on this metric may not effectively manage the scaling during periods of high message influx.
Calculating the approximate number of visible messages in the SQS queue for each instance allows for dynamic scaling based on actual workload. By creating a target tracking scaling policy for this metric, the Auto Scaling group can automatically adjust the number of EC2 instances to meet the demand, improving processing efficiency during peak message periods.
An Application Load Balancer (ALB) is typically used to distribute incoming application traffic across multiple targets, but it does not directly manage message processing from an SQS queue. Using ALBRequestCountPerTarget would not appropriately correlate with the performance of the worker processes handling SQS messages.
While creating an ALB and using scheduled scaling policies can help with known traffic patterns, it does not provide a responsive solution to the dynamic workload from the SQS queue. Scheduled scaling is not suitable for handling random periods of increased messages, as it lacks real-time responsiveness.