AWS High Availability: CloudWatch, ALB & Auto Scaling
Detect issues early, distribute traffic across Availability Zones, handle demand spikes, and redesign an EC2 app using serverless services.
Series: Skill Builder Digital Classroom - AWS Cloud Technical Essentials (11 articles)
- …
- 9AWS High Availability: CloudWatch, ALB & Auto Scaling This article
Your AWS App Is Running. But Will It Survive a Traffic Spike?
About Amazon CloudWatch, Elastic Load Balancing, EC2 Auto Scaling, high availability, and serverless architecture.
Your application worked perfectly yesterday.
Today, it's Monday morning. Employees are signing in, pages are loading slowly, and someone has already opened a support ticket.
The EC2 instance is still running. The database is available. The application worked during testing.
So what's broken?
This is where cloud architecture gets interesting.
Launching an application on AWS is one achievement. Keeping it available, observable, responsive, and cost-efficient is another.
A reliable application needs more than compute power. It needs visibility into failures, intelligent traffic distribution, sufficient capacity, and a recovery strategy.
Let's build those capabilities around a simple Employee Directory application and discover how AWS services work together to keep it running.
1. Monitoring: You Can't Fix What You Can't See
Imagine an Employee Directory application running on Amazon EC2.
Employee information lives in Amazon DynamoDB. Profile pictures are stored in Amazon S3. The EC2 instance runs the web application and handles incoming requests.
It's a straightforward architecture. Until something goes wrong.
A user reports that the website is slow. But that complaint doesn't reveal the underlying cause. It could be CPU saturation, network congestion, an application error, an unavailable dependency, or a recent deployment.
Monitoring turns that uncertainty into evidence. Instead of waiting for complaints, we collect information about how the system behaves and use it to recognize problems before they become widespread incidents.

Metrics are the language of infrastructure
AWS services generate operational data that helps explain what is happening inside an environment.
For EC2, useful metrics include CPU utilization, network traffic, disk I/O activity, and status checks. For Amazon RDS, database connections and CPU utilization may reveal resource pressure. For DynamoDB, throttled requests, consumed capacity, and request latency can reveal application behavior. Amazon S3 provides storage metrics, while additional request metrics can be enabled when needed.
But metrics aren't the entire story.
Metrics tell you that something changed. Logs provide more context about what happened. Network flow logs can help investigate traffic patterns. Application logs can reveal exceptions, failed requests, and unexpected behavior.
A server with high CPU utilization isn't necessarily unhealthy. It might simply be busy serving legitimate requests. A server with low CPU utilization isn't necessarily healthy either. Its application could be returning HTTP 500 errors while the processor remains mostly idle.
This is why effective monitoring begins with a baseline. Measure normal behavior, identify meaningful deviations, and connect those deviations to a response.
The objective isn't to collect every possible metric. It's to collect the signals that help answer operational questions: Is the application available? Are requests succeeding? Are response times acceptable? Is capacity sufficient? Are customers being affected?
The purpose of monitoring isn't more data. It's faster, better decisions.
2. Amazon CloudWatch: Turn Infrastructure Signals Into Action
This is where Amazon CloudWatch becomes useful.
CloudWatch is AWS's monitoring and observability service. It helps collect, visualize, and analyze metrics and logs from AWS resources and applications.
Think of CloudWatch as an operational control center rather than a collection of graphs.
For the Employee Directory application, we can build a dashboard that shows EC2 CPU utilization, application error counts, request activity, and relevant database metrics. Instead of opening multiple services to understand one incident, we gain a more connected view of the system.

Understanding basic and detailed monitoring
Amazon EC2 provides basic CloudWatch monitoring by default.
Most standard EC2 metrics are available at five-minute intervals. EC2 status check metrics are an exception, with one-minute availability. Detailed monitoring provides one-minute periods for additional EC2 metrics and incurs charges.
For operating-system memory utilization and disk-space usage, you'll generally need to install and configure the CloudWatch agent. Those are not standard EC2 metrics automatically supplied by the service.
The difference matters.
A five-minute CPU metric can be adequate for a small development application. An important production application with tight response-time requirements may justify more granular metrics and additional application-level monitoring.
The right monitoring configuration depends on how quickly you need to detect and respond to problems.
Creating a meaningful CloudWatch alarm
Suppose we want to know when the Employee Directory instance experiences sustained CPU pressure.
In CloudWatch, we select the EC2
CPUUtilization metric, define a statistic and monitoring period, and choose a threshold.For example, we could create an alarm that evaluates whether average CPU utilization remains above 70% for an appropriate evaluation period.
CloudWatch metric alarms have three primary states:
OK means the metric is within its configured threshold.
ALARM means the metric has breached the configured threshold according to its evaluation settings.
INSUFFICIENT_DATA means the alarm does not have enough usable information to determine its state.
An alarm can send a notification through Amazon Simple Notification Service (SNS). When using an email subscription, the recipient must confirm the subscription before receiving notifications.
One important detail: missing metric data isn't always equivalent to healthy infrastructure. CloudWatch allows you to configure how alarms treat missing data, and the appropriate choice depends on the metric being monitored.
From monitoring to automation
CloudWatch can do more than notify a human.
Application logs can be sent to CloudWatch Logs, where they can be searched and analyzed. Metric filters can turn matching log events, such as specific HTTP error patterns, into numerical metrics that can be visualized or monitored with alarms.
Applications can also publish custom metrics, such as failed sign-ins, API processing time, or completed directory searches.
Together, these capabilities create a feedback loop: collect information, detect meaningful change, notify the right people, and trigger suitable automated responses.

Monitoring tells you when your system is struggling. Architecture determines whether it survives.
3. Solution Optimization: Remove the Single Point of Failure
Let's return to the Employee Directory.
We have monitoring. We have dashboards. We have alerts.
But our application still runs on one EC2 instance.
If that instance fails, employees lose access to the directory even if DynamoDB and S3 remain available.
This is a single point of failure.
The simplest architectural improvement is to introduce redundancy. We add a second EC2 instance hosting the same application, preferably in another Availability Zone within the same AWS Region.
Why another Availability Zone?
Because running two instances isn't enough if both depend on the same failure domain. Using separate Availability Zones helps protect against an infrastructure or availability issue affecting one zone.

Availability has a measurable cost
Availability is often expressed as a percentage of uptime.
A system with 99.9% availability has approximately 8.76 hours of allowable downtime in a 365-day year. At 99.99%, that falls to roughly 52.56 minutes.
Those numbers illustrate an important trade-off.
Higher availability usually requires redundancy, recovery mechanisms, automation, testing, and additional infrastructure. Each improvement carries operational or financial costs.
Two application instances across Availability Zones are a meaningful improvement, but they're not a guarantee of a particular availability percentage.
You also need to consider software failures, deployment mistakes, dependency failures, shared configuration problems, and application state.
For example, if user sessions exist only on one EC2 instance, sending the next request to another instance may create an inconsistent experience. Shared session storage or a stateless application design can help.
Redundancy solves one problem.
Now we need to make multiple servers behave like one application.
4. Elastic Load Balancing: Give Users One Reliable Entry Point
We now have two EC2 instances.
But which one should receive the next request?
We don't want users manually choosing a server. We also don't want application clients managing a collection of changing server IP addresses.
This is the problem Elastic Load Balancing solves.
An AWS load balancer acts as a common entry point and distributes incoming requests across registered targets. AWS manages the load-balancing service, while we configure how traffic should be routed.
AWS offers different load balancer types for different workloads. Application Load Balancers operate at Layer 7 and are well suited for HTTP and HTTPS applications. Network Load Balancers operate at Layer 4 and support connection-oriented protocols such as TCP, UDP, and TLS. Gateway Load Balancers are designed for deploying and scaling virtual network appliances.
For our Employee Directory website, an Application Load Balancer (ALB) is a natural fit.
How an Application Load Balancer works
An ALB uses three important concepts.
A listener receives incoming connections on a specified protocol and port, such as HTTPS on port 443.
A target group contains the destinations that may receive traffic, such as the EC2 instances running our application.
A listener rule decides what action to take when a request matches specific conditions.
For example, requests to
/info could be forwarded to one target group, while other application requests follow a default rule. ALB routing can consider request paths, hostnames, and additional supported conditions.For our initial configuration, a single target group containing the application's two EC2 instances is sufficient.

Health checks: A running server isn't always a working application
A critical ALB capability is target health checking.
The load balancer periodically checks registered targets to determine whether they are suitable for receiving requests.
A useful application health endpoint might return a successful HTTP response when the application is ready to handle traffic.
But health checks require careful design.
A superficial check might confirm that the web server responds while missing a broken application dependency. An overly strict check might mark every instance unhealthy during a temporary shared-database outage, creating unnecessary instance replacement or reduced availability.
Separate basic process health from application readiness and broader dependency monitoring where appropriate.
The goal is to make routing decisions based on meaningful health signals, without turning every temporary downstream failure into a replacement storm.
Security and network placement
For a production-oriented design, place the internet-facing ALB in public subnets across at least two Availability Zones.
The application instances can run in private subnets, where they don't require directly reachable public IP addresses.
Configure the application instances' security group to accept relevant application traffic from the ALB's security group, rather than opening the application port to the entire internet.
Use HTTPS for public application traffic, with an appropriate TLS certificate, and consider encryption between the load balancer and backend targets according to your security requirements.
Now our users have one entry point and more than one application server.
That's a major reliability improvement.
But what happens when two servers aren't enough?
5. Amazon EC2 Auto Scaling: Capacity That Responds to Demand
Imagine the Employee Directory becomes popular across a growing organization.
At 9 AM, hundreds of employees access the application. Later, traffic falls. During a company-wide update, activity suddenly spikes again.
A fixed fleet of two instances may handle ordinary traffic but struggle under peak demand.
You could manually launch additional instances whenever traffic increases. But this approach is slow, error-prone, and inefficient.
Amazon EC2 Auto Scaling makes the process more adaptive.
The service can maintain a defined number of EC2 instances, replace unhealthy instances, and adjust fleet capacity according to scaling policies.
The three building blocks of Auto Scaling
1. Launch template What should run?
A launch template specifies how new EC2 instances should be created. This can include the AMI, instance type, security groups, IAM instance profile, storage settings, and initialization instructions.
2. Auto Scaling group Where and how many?
An Auto Scaling group defines the fleet, networking placement, and capacity boundaries.
For our Employee Directory example, we can configure:
Minimum capacity: 2 instances
Desired capacity: 2 instances
Maximum capacity: 4 instances
This means the group initially aims to maintain two instances and can increase capacity up to the configured maximum when scaling conditions justify it.
3. Scaling policy When should capacity change?
A scaling policy defines how the fleet should respond to changing demand.
With a target tracking policy, we can select average EC2 CPU utilization and set a target such as 60%.
Amazon EC2 Auto Scaling automatically creates and manages the associated CloudWatch alarms for target tracking. It then adjusts capacity to move the monitored metric toward the chosen target.
This is not simply a rule that always adds exactly one server when CPU touches 60%. The actual scaling decision depends on policy evaluation, current capacity, metric behavior, and related settings.

Scaling out, scaling in, and warmup
When demand rises, Auto Scaling can launch new instances. When demand falls, it can remove excess capacity while respecting the minimum group size.
This is horizontal scaling.
It differs from vertical scaling, where you increase the computing power of an existing server by moving to a larger instance type.
Horizontal scaling is particularly useful for stateless web applications whose requests can be distributed across multiple identical instances.
New instances also need time to boot, install or start application components, and become ready to serve traffic.
That's why instance warmup matters.
For the lab, we can use a 300-second warmup setting. During warmup, target tracking accounts for newly launched capacity so it doesn't make inappropriate scaling decisions based on instances that haven't fully warmed up.
The correct warmup period depends on the application's real startup time.
Why the load balancer matters here
EC2 Auto Scaling and Elastic Load Balancing complement one another.
When the Auto Scaling group launches new instances, they can be automatically registered with the associated target group.
The ALB checks target health before routing application requests to the new instances.
When instances are removed, deregistration helps stop new requests from reaching those targets and can allow existing requests to complete within the configured delay.
If Elastic Load Balancing health checks are enabled for the Auto Scaling group, Auto Scaling can also use unhealthy target reports to replace instances that are running but unable to serve the application correctly.
Auto Scaling handles fleet capacity. The load balancer handles request distribution. CloudWatch helps supply the signals behind operational decisions.
Together, they create an architecture that can react to changing demand with less manual intervention.
But configuration only becomes credible when you test it.
6. Practical Demonstration: Build and Test a Highly Available AWS Application
Let's turn the architecture into a working lab.
We know the Employee Directory application, with its data stored in DynamoDB and profile images stored in S3.
The objective is to run multiple application instances across Availability Zones, distribute requests through an ALB, and scale capacity based on demand.
Step 1: Prepare the application instances
Start by confirming that the application runs correctly on an EC2 instance and can access the required DynamoDB table and S3 bucket.
Use an appropriately scoped IAM role for access to those services. Keep AWS credentials out of application source code and EC2 user data.
For the scalable deployment, make sure the launch template can initialize identical application instances, including the correct startup commands, application configuration, security group, and IAM instance profile.
Step 2: Configure the Application Load Balancer
Create an internet-facing Application Load Balancer in the application's VPC and select public subnets in at least two Availability Zones.
Create a target group for the application and configure a health-check path that accurately represents application readiness.
Associate the target group with a listener. For a production-oriented deployment, use HTTPS with a suitable certificate. An HTTP-only configuration may be acceptable for an isolated training exercise but should not be treated as a secure public production configuration.
Before proceeding, verify that the application can be reached through the load balancer's DNS name and that its registered targets report healthy status.
Step 3: Create the launch template
Open the EC2 console and create a launch template for the Employee Directory.
Specify a compatible AMI and instance type, the application's security group, its IAM instance profile, and user data or another automated initialization mechanism.
The objective is simple: every instance launched by the Auto Scaling group should be able to serve the same application without manual intervention.
If you're deploying into private subnets, ensure the instances have the necessary network access to retrieve packages, application artifacts, and AWS service resources, using appropriate NAT connectivity or VPC endpoints.
Step 4: Configure the Auto Scaling group
Create an Auto Scaling group using the launch template.
Select subnets across two Availability Zones. Attach the existing ALB target group and enable Elastic Load Balancing health checks.
Set the group's minimum, desired, and maximum capacities to 2, 2, and 4 instances respectively.
Then configure a target tracking scaling policy using average EC2 CPU utilization with an example target value of 60%.
For the demonstration, use 300 seconds of instance warmup, adjusting the value if application startup time requires it.
Step 5: Generate traffic and observe the response
The training application includes a demonstration feature on its
/info page that simulates CPU pressure.In an isolated lab environment, run the built-in ten-minute stress test and watch the system respond.
You should inspect the CPU metrics in CloudWatch, the Auto Scaling group's activity history, the EC2 instance count, and the target health status in the load balancer.
If sustained demand leads the scaling policy to increase capacity, new instances should appear in the group. Once properly initialized and healthy, they can receive application traffic through the ALB.
Don't assume every test will produce the same scaling timeline or number of instances. Metric resolution, evaluation settings, capacity limits, instance startup, and actual CPU behavior all influence the outcome.

Step 6: Validate recovery and clean up
Scaling is only one part of the exercise.
Test how the system behaves if an instance becomes unhealthy. Confirm that the load balancer detects the issue and that the Auto Scaling group can replace the instance when its configured health checks require replacement.
Test whether the application remains usable while individual instances are removed from service.
Finally, delete the lab resources that are no longer required.
Remove the Auto Scaling group before manually terminating its managed instances; otherwise, the group may launch replacements to maintain its desired capacity.
Review the load balancer, EC2 resources, storage, monitoring resources, and other billable infrastructure. Deleting an EC2 instance alone may not remove all associated costs.
A current billing note: AWS changed its Free Tier program in July 2025. Eligible new customers can receive up to $200 in credits, with a free account plan available for up to six months or until credits are exhausted. The older blanket assumptions about particular EC2 instance types being free for every new account should not be relied upon. Always verify your account's plan, eligibility, service charges, and current AWS pricing.
We now have a distributed application with monitoring, load balancing, health checks, and automated capacity management.
This is a major improvement over a single EC2 instance.
But it introduces another question.
What if we could reduce the amount of server infrastructure we manage in the first place?
7. Employee Directory Redesign: From EC2 to Serverless
The architecture we built is an example of a traditional web application running on managed cloud infrastructure.
EC2 instances host the frontend and backend application logic. DynamoDB stores employee records. S3 stores employee profile images.
That design works.
But it also means managing instance configuration, application deployment, operating-system updates, security patching, capacity policies, and scaling behavior.
An alternative is to separate the application's responsibilities and use managed serverless services where they fit.
Separate presentation, application logic, and data
The Employee Directory has three conceptual layers.
The presentation layer contains the user interface: HTML, CSS, and JavaScript.
The application layer handles requests and business logic, such as fetching, creating, updating, or deleting employee records.
The data layer stores persistent information, including structured employee data and image assets.
In our original architecture, EC2 hosts both the presentation and application layers.
In a serverless redesign, we can move the frontend assets to Amazon S3 and use Amazon CloudFront to deliver them securely.
Amazon API Gateway can provide the API that the frontend calls. AWS Lambda functions can execute the backend application logic. DynamoDB continues to hold structured employee records, and S3 continues to hold profile images.
Amazon Route 53 can route the application's domain name to CloudFront.

Follow one request through the new architecture
Imagine an employee opens the directory website.
First, DNS resolves the application's domain through Route 53 to the CloudFront distribution.
CloudFront serves the frontend files, retrieving them from the S3 origin when necessary.
The browser renders the website.
When the user requests a list of employees, frontend JavaScript sends an authenticated API request to API Gateway.
API Gateway routes the request to the appropriate Lambda integration.
The Lambda function executes the relevant business logic and retrieves the required records from DynamoDB using its IAM permissions.
The API response returns to the browser, where JavaScript updates the page with the employee information.
Profile images can be delivered through appropriately secured S3 and CloudFront access patterns.
The user sees a dynamic website, even though its frontend consists of static files.
An important security distinction: use a private S3 bucket with a CloudFront S3 origin and Origin Access Control when designing this secure delivery pattern. Don't confuse that arrangement with an S3 website endpoint, which has different access and HTTPS limitations.
Why this redesign matters
The first advantage is reduced server management.
With Lambda, you no longer manage EC2 instance fleets, operating-system patch cycles, or EC2 Auto Scaling groups for that particular backend workload.
API Gateway and Lambda provide managed request handling and compute scaling within their supported configurations and quotas.
The second advantage is architectural flexibility.
We can replace how the frontend and backend run while retaining DynamoDB and S3 as persistent data services.
The third advantage is potentially better cost alignment for certain traffic patterns.
With appropriate serverless services, some workloads benefit from usage-based billing rather than maintaining a continuously running application fleet.
But serverless isn't automatically cheaper or faster.
High request volume, execution duration, concurrency requirements, cold starts, API Gateway pricing, and application dependencies can change the economics.
Operational responsibilities also remain. You still need monitoring, security, access control, API protection, data modeling, observability, and deployment discipline.
A serverless architecture reduces certain infrastructure responsibilities; it doesn't eliminate the need for good engineering.
The real lesson: Build for change
The biggest takeaway from the Employee Directory isn't that one architecture is universally superior.
It's that AWS gives you multiple ways to solve the same business problem.
EC2 offers direct control over compute environments.
Elastic Load Balancing distributes application requests.
EC2 Auto Scaling adjusts instance fleet capacity.
CloudWatch improves visibility and supports operational responses.
Lambda, API Gateway, CloudFront, S3, and DynamoDB enable a different approach with more managed components.
The right choice depends on application requirements, reliability targets, team expertise, performance expectations, security needs, and total cost.
Don't choose infrastructure because it's fashionable.
Choose it because it solves a clearly defined problem.
Final Thoughts: Reliability Is Designed, Not Assumed
An application doesn't become resilient simply because it's hosted in the cloud.
It becomes more resilient when you intentionally design how it observes problems, handles traffic, responds to demand, and recovers from failure.
Our Employee Directory began with one EC2 instance.
We added monitoring through CloudWatch, reduced application-level single points of failure through redundancy, introduced intelligent request routing with an Application Load Balancer, and automated fleet management with EC2 Auto Scaling.
Finally, we explored how the same application could be redesigned around managed serverless services.
Each change addressed a different operational challenge.
That's the mindset behind effective cloud engineering.
Measure what matters. Remove avoidable failure points. Automate repeatable decisions. Design for the workload you actually have.
Because the best cloud architecture isn't necessarily the one with the most services.
It's the one that delivers the reliability your users need, with complexity your team can manage.
Open to Cloud Ops Remote and technical writing projects.
Series: Skill Builder Digital Classroom - AWS Cloud Technical Essentials (11 articles)
- …
- 9AWS High Availability: CloudWatch, ALB & Auto Scaling This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article