Soru

Zorluk: OrtaImplementing Auto Scaling and Fault Tolerance

A SaaS company operates a document generation platform on AWS. The application tier runs on Amazon EC2 instances within an Auto Scaling group (ASG) behind an Application Load Balancer (ALB) across three Availability Zones. The instances are launched from a standard Amazon Linux AMI and execute a user data bootstrap script to download 4 GB of template libraries and compile application dependencies. This process takes 8 minutes before the instances can pass ALB health checks. During scheduled marketing events, a rapid spike in requests causes the ASG's target tracking policy (set to 70% average CPU utilization) to launch new instances. However, because these instances take 8 minutes to bootstrap, the ASG repeatedly launches additional instances before the first batch becomes healthy, leading to severe over-provisioning. Additionally, a recent NAT Gateway outage in Availability Zone A prevented instances in Availability Zones B and C from retrieving remote template libraries during bootstrapping. Which solution should a Solutions Architect implement to resolve the scaling instability and ensure high availability for outbound traffic?

  1. Create a custom AMI with the template libraries and dependencies pre-installed, update the Auto Scaling group to use this AMI, and configure a target tracking scaling policy with an instance warmup of 120 seconds. Deploy a NAT Gateway in each Availability Zone and configure the route table of each private subnet to route outbound traffic through its local NAT Gateway.Cevap
  2. B
    Retain the base Amazon Linux AMI with the user data bootstrapping script, but decrease the default cooldown period of the Auto Scaling group to 60 seconds to launch instances faster. Deploy a NAT Gateway in each Availability Zone and configure the private subnet route tables to route outbound traffic locally.
  3. C
    Create a custom AMI with the template libraries and dependencies pre-installed, update the Auto Scaling group to use this AMI, and configure a target tracking scaling policy with an instance warmup of 120 seconds. Keep the single NAT Gateway in Availability Zone A to minimize hourly charges, and use an AWS Lambda function to update the route tables of Availability Zones B and C to point to a backup NAT Gateway if an outage is detected.
  4. D
    Submit a request to AWS Support to pre-warm the Application Load Balancer prior to scheduled events. Deploy a NAT Gateway in each Availability Zone and update the private subnet route tables. Retain the base AMI and user data bootstrapping script, and configure a target tracking scaling policy based on the Application Load Balancer request count per target.

Cevap

Create a custom AMI with the template libraries and dependencies pre-installed, update the Auto Scaling group to use this AMI, and configure a target tracking scaling policy with an instance warmup of 120 seconds. Deploy a NAT Gateway in each Availability Zone and configure the route table of each private subnet to route outbound traffic through its local NAT Gateway.
Pre-baking the dependencies and libraries into a custom AMI drastically reduces the bootstrapping time to under a minute. Combined with setting an appropriate instance warmup period, this prevents the Auto Scaling group from repeatedly launching unnecessary instances before the first batch can help handle the workload. Additionally, deploying a NAT Gateway in each Availability Zone ensures there is no single point of failure for outbound traffic and maintains high availability across all zones.

Adım Adım Çözüm

1
Identify the root cause of the Auto Scaling group over-provisioning.
The 8-minute bootstrapping process causes a lag in instances becoming healthy, leading target tracking to assume more capacity is needed.
To prevent this, the boot time must be reduced, and the scaling policy must be given sufficient warmup time.
2
Determine the best approach to reduce the initialization time.
Create a custom AMI with pre-installed template libraries and dependencies, reducing launch-to-ready time from 8 minutes to under 1 minute.
This minimizes the time instances spend in the bootstrapping phase and allows them to handle traffic almost immediately.
3
Eliminate the single point of failure for outbound traffic.
Deploy a NAT Gateway in each Availability Zone and update corresponding private subnet route tables to route outbound traffic locally.
This ensures that a failure of a NAT Gateway in one Availability Zone does not impact outbound traffic or bootstrapping in other zones.

Anahtar Kavram

Scaling policy tuning and multi-AZ fault tolerance for outbound network paths.
Tahmini Süre:2m 30s
Bu soruyu puanla