Multi-Region Failover with Global Accelerator
Route traffic across two AWS regions with automatic failover using Global Accelerator.
Project work by YOUHAD AYOUB on NextWork.
Building a Multi-Region Architecture on AWS
Project goals and SAA-C03 relevance
In this project, I'm building a multi-region architecture fronted by AWS Global Accelerator, routing traffic across two AWS Regions and proving automatic failover when one region goes down.
Deploying regional web servers
I'm In this step, I will launch an EC2 instance in us-east-1 and a second EC2 instance in us-west-2, each configured with a user data script that automatically installs and starts the Apache web server. I will then verify that both instances are accessible through a web browser and display region-specific messages, confirming that the web servers have been deployed successfully across multiple AWS Regions and are responding as expected.
Security group configuration
Here is a brief breakdown of what those security groups allow and why they are necessary:
What they allow: Inbound HTTP traffic on port 80 from anywhere (0.0.0.0/0).
Why it is needed: It allows AWS Global Accelerator to perform automated health checks on your backend servers and route global user traffic directly to your EC2 instances from edge locations worldwide.
Creating the Global Accelerator Entry Point
Setting up the accelerator, listener, and endpoint groups
In this step, I will create an AWS Global Accelerator with a TCP listener on port 80 to provide a single set of static IP addresses for accessing my application. I will configure endpoint groups in both us-east-1 and us-west-2 using the default health check settings, then register my EC2 instances as endpoints within their respective Regions. Finally, I will verify that traffic is successfully routed through the accelerator's static IP addresses and observe how Global Accelerator directs users to healthy endpoints using the AWS global network for improved performance and availability.
Static anycast IPs vs. EC2 public IPs
Static Anycast IPs (provided by AWS Global Accelerator): Two constant IP addresses that act as a single entry point for your global users. Traffic is automatically routed through the closest AWS edge location and over the AWS global network to the healthiest regional endpoint.
EC2 Individual Public IPs: Region-specific IP addresses that route traffic directly to one specific EC2 instance over the public internet. If that instance fails or is recreated, its public IP changes, and it has no built-in global failover capabilities.
Shaping Traffic with Dials and Weights
Controlling routing behavior
In this step, I'm shaping traffic by setting In this step, I'm shaping traffic by Setting the us-east-1 traffic dial to 0% and confirm all traffic shifts to us-west-2. then Adjust endpoint weights to bias traffic distribution between regions. and finally Set the us-west-2 traffic dial to 0% to prepare for the failover experiment.
Traffic dials vs. endpoint weights explained
(Regional Level): Controls how much traffic goes to an entire endpoint group (typically an AWS region). For example, setting a dial to 50 limits that region to receiving 50% of its normal traffic share.
Endpoint Weight (Resource Level): Controls how traffic is distributed among individual resources (such as load balancers or EC2 instances) within a single endpoint group.
Triggering and Observing Cross-Region Failover
Proving failover behavior under failure conditions
In this step, I'll
- Stop the us-east-1 EC2 instance and watch its health state change to Unhealthy.
- Confirm that failover routes traffic to us-west-2 despite its 0% traffic dial.
- Restart the instance and restore normal operation across both regions.
Why failover ignores traffic dial settings
AWS Global Accelerator prioritizes application availability over your configured routing preferences.
When all endpoints in your primary region became unhealthy, the accelerator initiated an automatic failover. During this failover process, the system ignores traffic dial settings of the standby regions to prevent a complete application outage. Since the endpoints in your us-west-2 group were healthy and had positive weights, traffic was successfully routed there to keep your service online
Fine-Tuning Health Checks and Client Affinity
Client affinity behavior during failover
When client affinity (Source IP stickiness) is enabled on an AWS Global Accelerator listener and the active endpoint becomes unhealthy, the failover behavior operates as follows:
Availability Prioritized: Global Accelerator immediately overrides the affinity mapping. It prioritizes availability over session stickiness, ensuring traffic is not sent to the unhealthy endpoint docs.aws.amazon.com.
New Connections Rerouted: All new connections from the client are redirected to the next closest healthy endpoint within the same endpoint group. If none exist locally, traffic fails over to healthy endpoints in other regional groups docs.aws.amazon.com.
Existing Connections: Active connections to the failed endpoint are interrupted. Once the client re-establishes a connection, it is instantly routed to a healthy endpoint, creating a new affinity mapping
Reflections and Takeaways
Key tools and concepts
The key tools I used include :
AWS Global Accelerator : Provisioning static Anycast IP addresses to route user traffic over the AWS private global network, improving performance and availability.
Multi-Region Redundancy: Deploying independent web servers across two distinct AWS geographic regions to avoid single-point-of-failure architectures.
Traffic Control: Configuring Traffic Dials to shift traffic balance between entire AWS regions, and setting Endpoint Weights to adjust load between resources inside a region.
Automated Failover: Setting up native health checks to automatically route global users to a healthy backup region within seconds of an outage, bypassing the delay of traditional DNS caching.
Time and challenges
This project took me approximately 1 hour
What's next
I did this project today to learn how to... Another skill I want to learn is...