Customers upload files to S3 and an SQS message containing the object ARN is sent. An EC2-based worker polls SQS and processes files; processing time varies with file size. To reduce customer-perceived delays, an administrator creates an AMI from the existing instance and a launch template. How should Auto Scaling be configured to improve responsiveness?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a custom metric based on the ApproximateNumberOfMessagesVisible metric and the number of instances in the InService state in the Auto Scaling group. Modify the application to calculate the metric and post the metric to Amazon CloudWatch once each minute. Create an Auto Scaling policy based on this metric to scale the number of instances..
Why this is the answer
The correct option directly addresses the problem of varying processing times and the need for responsiveness. By creating a custom metric that divides ApproximateNumberOfMessagesVisible (messages waiting to be processed) by the number of InService instances, the Auto Scaling group can scale based on the actual workload per instance. When this ratio increases, it indicates that each instance has more messages to process, triggering a scale-out. When it decreases, a scale-in can occur. This ensures that the number of worker instances dynamically adjusts to the SQS queue backlog, minimizing customer-perceived delays. Incorrect options: Using different instance sizes with ApproximateNumberOfMessagesVisible alone doesn't account for processing capacity per instance; it just scales based on total messages, not workload per instance. ApproximateNumberOfMessagesDelayed is for messages that have been explicitly delayed, not those waiting to be processed, so it's not relevant for scaling based on current workload. A custom metric based on ASGAverageCPUUtilization and GroupPendingInstances is not directly tied to the SQS queue backlog, which is the primary driver of the workload in this scenario.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed