High Availability Patterns
Multi-AZ — redundancy within a region. RDS Multi-AZ: Used for failover uses synchronous replication to standby. Automatic failover via DNS. Not for read scaling.
Multi-Region — disaster recovery and global latency reduction.
Auto Scaling Groups (ASG) — launch template defines AMI, instance type, EBS volumes, security groups, IAM role, subnets, LB info. Scaling policies:
- Target Tracking — simplest. E.g., keep avg CPU at 40%.
- Simple / Step Scaling — trigger on CloudWatch alarm. "If CPU > 70%, add 2 instances."
- Scheduled Scaling — known usage patterns. "Add capacity at 5pm Fridays."
- Predictive Scaling — ML-based forecast; schedules scaling in advance.
Cooldown period (default 300s) — after scaling action, ASG won't launch/terminate more instances. Use pre-configured AMIs (Golden AMIs) to reduce boot time and shorten cooldown.
Good metrics to scale on: CPUUtilization, RequestCountPerTarget (from ALB), Average Network In/Out, custom CloudWatch metrics.
