A company is migrating a web application to AWS and wants to automatically scale the application based on CPU utilization. The application runs on a set of EC2 instances behind an Application Load Balancer. Which combination of AWS services should they use?
Trap 1: AWS Lambda with scheduled scaling
Lambda cannot run or scale the existing EC2 fleet, and scheduled scaling triggers on time, not CPU utilisation. It is tempting because Lambda is serverless and event-driven, and would be correct for scheduled batch jobs or event-triggered functions rather than load-driven EC2 scaling.
Trap 2: Amazon CloudFront with origin scaling
CloudFront caches and delivers content at edge locations; it has no origin scaling capability and cannot add EC2 capacity from CPU metrics. It is tempting because it fronts web applications, and would be correct for reducing latency and offloading static content, not for scaling compute.
Trap 3: AWS Elastic Beanstalk with environment scaling
Elastic Beanstalk manages its own environment and scaling policies, which conflicts with the requirement to scale the existing EC2 fleet behind an Application Load Balancer directly from CPU metrics. It is tempting as a managed platform, and would be correct for deploying a new application without existing infrastructure.
- A
AWS Lambda with scheduled scaling
Why it fails: Lambda cannot run or scale the existing EC2 fleet, and scheduled scaling triggers on time, not CPU utilisation. It is tempting because Lambda is serverless and event-driven, and would be correct for scheduled batch jobs or event-triggered functions rather than load-driven EC2 scaling.
- B
Amazon CloudFront with origin scaling
Why it fails: CloudFront caches and delivers content at edge locations; it has no origin scaling capability and cannot add EC2 capacity from CPU metrics. It is tempting because it fronts web applications, and would be correct for reducing latency and offloading static content, not for scaling compute.
- C
AWS Elastic Beanstalk with environment scaling
Why it fails: Elastic Beanstalk manages its own environment and scaling policies, which conflicts with the requirement to scale the existing EC2 fleet behind an Application Load Balancer directly from CPU metrics. It is tempting as a managed platform, and would be correct for deploying a new application without existing infrastructure.
- D
Auto Scaling group with a simple scaling policy based on CloudWatch CPU alarm
An Auto Scaling group with a simple scaling policy triggered by a CloudWatch CPU utilisation alarm adjusts desired capacity automatically, satisfying the CPU-based scaling requirement. The Application Load Balancer distributes traffic across the scaled instances, keeping the architecture responsive under varying load.