Interview Prep/AWS/EC2, Auto Scaling and Load Balancing

Design a self-healing stateful service on EC2, such as a leader-based cluster, with EBS volumes.

AdvancedScenarioEC2, Auto Scaling and Load Balancing
Answer

Situation read → EBS is AZ-bound, so replacement logic must re-attach or rebuild in the same AZ.

What I'd do →

  1. One ASG per AZ with min and max 1, or lifecycle hooks that attach the volume
  2. Tag volumes and attach with a user data script using the instance's AZ
  3. Prefer replicated data (rebuild from peers) over reattachment
  4. Use EBS snapshots through Data Lifecycle Manager
  5. Alarm on replication lag

Why → Rebuild-from-peer avoids long reattach waits and corruption risk from forced detach.

Interview tip → If possible, push state to a managed service.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing