自动扩展(Auto Scaling) 根据需求自动调整正在运行的资源数量(例如 EC2 实例)——当负载增加时添加容量,当负载减少时移除容量。这是构建既可靠(处理流量突增)又具成本效益(不过度配置)的应用程序的关键。
自动扩展的作用
text
Auto Scaling adjusts capacity AUTOMATICALLY based on demand:
→ load INCREASES (traffic spike) → add instances (scale OUT) → handle the load
→ load DECREASES → remove instances (scale IN) → save money
→ Match capacity to demand automatically: reliable under load, cheap when idle.
EC2 自动扩展组(ASG)
text
An AUTO SCALING GROUP manages a fleet of EC2 instances:
MIN / MAX / DESIRED capacity → bounds and target number of instances
LAUNCH TEMPLATE → how to launch new instances (AMI, type, config)
SCALING POLICIES → rules for when to scale (see below)
HEALTH CHECKS → replace unhealthy instances automatically (self-healing!)
→ typically spread across multiple AZs (high availability)
