Question

Difficulty: MediumAuto Scaling and Elasticity

A SysOps administrator is configuring scaling for an Amazon EC2 Auto Scaling group (ASG) that processes messages from an Amazon SQS queue. The workload fluctuates significantly throughout the day. The administrator wants to use a target tracking scaling policy to scale the ASG dynamically, keeping the backlog at approximately 100 messages per EC2 instance. Which two actions must the administrator take to implement this configuration? (Select TWO.)

  1. Create a custom metric in Amazon CloudWatch using metric math to calculate the backlog per instance by dividing the SQS ApproximateNumberOfMessagesVisible metric by the Auto Scaling group's group size.Answer
  2. Configure a target tracking scaling policy on the Auto Scaling group that uses the custom backlog per instance metric and set the target value to 100.Answer
  3. C
    Configure a target tracking scaling policy on the Auto Scaling group that directly tracks the SQS ApproximateNumberOfMessagesVisible metric with a target value of 100.
  4. D
    Enable detailed monitoring on the EC2 instances within the Auto Scaling group to ensure that SQS queue metrics are reported at 1-minute intervals.
  5. E
    Create an IAM role for the Auto Scaling group that includes the iam:PassRole permission to grant the instances permissions to pull metrics from the SQS queue.

Answer

The correct configuration requires creating a custom CloudWatch metric using metric math to calculate the backlog per instance (ApproximateNumberOfMessagesVisible divided by the group size) and then configuring a target tracking scaling policy on the Auto Scaling group using this custom metric with a target value of 100.
To scale an Auto Scaling group based on SQS queue backlog, the scaling metric must change in proportion to the number of instances. The correct actions are to create a custom metric using CloudWatch metric math that divides the SQS queue depth by the current group size, and then apply a target tracking policy that uses this custom metric. This ensures that when the group scales out, the backlog per instance decreases, allowing the scaling policy to stabilize.

Step-by-Step Solution

1
Calculate the queue backlog metric per instance.
A custom CloudWatch metric is created using metric math. It pulls the SQS ApproximateNumberOfMessagesVisible metric and divides it by the ASG's GroupInServiceInstances or group size metric.
Target tracking scaling policies require a metric that increases or decreases proportionally with the size of the Auto Scaling group. The raw SQS queue length does not change when the group scales out, but the backlog per instance does.
2
Configure the target tracking policy.
A target tracking policy is applied to the Auto Scaling group referencing the custom metric.
Setting the target value to 100 instructs the scaling policy to scale out when the backlog per instance exceeds 100, and scale in when it drops below 100, maintaining optimal utilization.

Key Concept

Scaling an Auto Scaling Group (ASG) based on SQS queue size requires a custom backlog-per-instance metric calculated via CloudWatch metric math, as target tracking cannot use raw queue depth directly without causing runaway scaling.
Rate this question