7.78 Route 53 EC2 Setup
In this lab we build three EC2 instances plus an Application Load Balancer so we can demonstrate Route 53 routing policies on real resources spread across Regions. The instances live in Seoul (ap-northeast-2), Frankfurt (eu-central-1) and Ireland (eu-west-1). For each instance we launch Amazon Linux 2, keep most defaults, and inject a user-data script that updates the system, installs Apache and enables the service at boot.
The user-data also queries the EC2 metadata endpoint at http://169.254.169.254/ to fetch the Availability Zone and render it on the default Apache page. That way each home page proves which Region served the request. We allow HTTP in the security group, keep the default storage, skip tags and pick an existing key pair only for the main Region (Ireland) — the other two are managed via Session Manager.
Load balancer on the main Region
- From EC2 > Load Balancing, create an Application Load Balancer, internet-facing on port 80, with several subnets in different AZs.
- Create a new security group called
route53-elb-sgthat allows HTTP from the internet. - Create a target group
route53-ec2-tgof type instance, protocol HTTP on port 80, default health-check path, and register the Ireland instance.
Once the load balancer is provisioned, hitting its DNS name returns the Ireland page through Apache. Each instance is also reachable directly via its own DNS name. In real production you would lock down the instances behind the load balancer's security group only, as covered in previous sections, but for this exercise we just verify that the instances respond and that the load balancer correctly forwards traffic. The lab environment is now ready to test Route 53 routing policies.