Skip to main content

Amazon EC2 Auto Scaling

  • What it is
    • Keeps a group of Amazon EC2 instances at the right size: adds instances when demand rises, removes them when it falls, and replaces instances that fail health checks.
  • The moving parts
    • Auto Scaling group (ASG) — the managed set, with minimum / desired / maximum capacity.
    • Launch template — the instance recipe: Amazon Machine Image (AMI), instance type, security groups, user data.
    • Spans multiple Availability Zones and rebalances across them, which is how it delivers High Availability.
  • Scaling policies
    • Target tracking — hold a metric at a value (e.g. average CPU at 50%). The default choice.
    • Step / simple scaling — react to Amazon CloudWatch alarm thresholds.
    • Scheduled — for known patterns, like business hours.
    • Predictive — forecasts from history and scales ahead of the curve.
  • Health and self-healing
    • Failed EC2 or ELB health checks terminate the instance and launch a replacement — so instances must be treated as ephemeral and hold no state.
  • Not to be confused with
    • AWS Auto Scaling — the multi-service front end that also scales DynamoDB, ECS, Aurora replicas. EC2 Auto Scaling is EC2 only.
    • Elastic Load Balancing — distributes traffic across instances; it does not create or remove them. They are used together.
    • Vertical scaling (a bigger instance) — this is horizontal scaling, more instances.
  • Exam signal
    • “Automatically add or remove instances”, “handle unpredictable demand”, “replace unhealthy instances” → EC2 Auto Scaling. It is both an Elasticity and a Reliability answer.

Linked from