SOA-C03 · Question #20
A company uses an Amazon Simple Queue Service (Amazon SQS) queue and Amazon EC2 instances in an Auto Scaling group with target tracking for a web application. The company collects the…
The correct answer is B. Define and use Amazon CloudWatch metric math to calculate the SQS queue backlog for each. To reduce SQS message backlog during peak traffic, the engineer needs a scaling policy that responds directly to queue depth per instance, which requires CloudWatch metric math to calculate the backlog per instance ratio.
Question
A company uses an Amazon Simple Queue Service (Amazon SQS) queue and Amazon EC2 instances in an Auto Scaling group with target tracking for a web application. The company collects the ASGAverageNetworkIn metric but notices that instances do not scale fast enough during peak traffic. There are a large number of SQS messages accumulating in the queue. A CloudOps engineer must reduce the number of SQS messages during peak periods. Which solution will meet this requirement?
Options
- ADefine and use a new custom Amazon CloudWatch metric based on the SQS
- BDefine and use Amazon CloudWatch metric math to calculate the SQS queue backlog for each
- CDefine and use step scaling by specifying a ChangeInCapacity value for the EC2 instances.
- DDefine and use simple scaling by specifying a ChangeInCapacity value for the EC2 instances.
How the community answered
(31 responses)- A6% (2)
- B77% (24)
- C13% (4)
- D3% (1)
Why each option
To reduce SQS message backlog during peak traffic, the engineer needs a scaling policy that responds directly to queue depth per instance, which requires CloudWatch metric math to calculate the backlog per instance ratio.
A custom CloudWatch metric based on SQS alone (without per-instance normalization via metric math) does not account for the current number of running instances, making it an inaccurate signal for target tracking scaling decisions.
CloudWatch metric math can compute the SQS backlog per instance by dividing the ApproximateNumberOfMessagesVisible metric by the number of running instances, creating a dynamic target tracking metric that scales EC2 capacity proportionally to queue depth. This approach is the AWS-recommended pattern for SQS-based autoscaling, ensuring instances scale fast enough to drain the queue during peak periods. By targeting a specific backlog-per-instance value, the Auto Scaling group responds directly to message accumulation rather than an unrelated network metric.
Step scaling with ChangeInCapacity adds a fixed number of instances at defined thresholds, which is less precise and reactive than a target tracking policy driven by the actual per-instance queue backlog metric.
Simple scaling requires a cooldown period after each scaling action before evaluating further alarms, making it too slow to respond to rapidly accumulating SQS messages during peak traffic compared to target tracking with metric math.
Concept tested: SQS-based autoscaling using CloudWatch metric math
Source: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-using-sqs-queue.html
Topics
Community Discussion
No community discussion yet for this question.