Welcome back friends.
Let's do hands-on with Route 53.
In this hands-on, we will learn about
Route 53 latency-based routing.
We will launch 2 EC2 instances with
running web servers.
1 EC2 instance I will launch in the
Northern Virginia AWS region, and for the
other
one, I'll launch in the Mumbai AWS region.
Then we will see how Route 53 uses
latency-based routing to route traffic to
these EC2
instances.
But before doing hands-on with Route 53
routing policy, you need to have a domain
name
Registering for a domain name is not free,
so if you are not interested in
registering
for a domain name, just watch how it works
instead of doing hands-on.
Let's go to Route 53.
I'm planning to register a domain.
Let me enter my domain name here.
First, I need to check if the domain name
is available or not.
As you can notice, the domain name is
available with the exact match.
It also provides suggestions for the other
available domain name.
I'm happy with this domain name.
I can click on select.
I will click on proceed to checkout.
If you are not planning to use it after a
year, please uncheck it so that
auto renewal will be turned off.
Let me click on proceed to checkout to
register the domain.
Here.
I need to register the domain.
Let me do it offline to finish the
process.
As you can notice, my order is processed.
If you go to the domain, as you can
notice, it says that domain registration
is
in progress.
After some time you should see the domain
registration will be completed and you
should see
the expiration time and other details such
as whether auto renewal is turned on or
not
Now if you go to hosted zone on your left
side, you should see hosted zone
In my case, I see the hosted zone has been
created.
Now we will use this hosted zone to add
the DNS records for the EC2 instances
that we will be launching soon.
Right now you see two DNS records are
created.
One is for the name server, which is
essentially the DNS names of the name
servers
The other one is SOA, a start of authority
record that stores important
information about a domain such as the
administrator's email address.
Let's go ahead and launch EC2 instances.
I will launch the first one in the
Northern Virginia region, which will have
a running
web server, and the homepage will display
Hello World from Northern Virginia AWS
region.
Let's launch it.
I will launch in the free tier and proceed
without a key pair as SSH is
unnecessary.
I'll create a new security group that
allows HTTP access from anywhere.
Let's scroll down.
Under advanced detail.
We are going to add EC 2 user data, which
will install a web server and
add index.html.
Let me copy and paste the EC 2 user data
script.
Let's launch this instance right now.
This instance is getting launched.
Now let me switch AWS region.
Let's go to the Mumbai AWS region, and I
will launch the other EC2 instance in
the Mumbai AWS region.
I will launch this instance in the same
way as I launched the previous one, which
means I will launch in the free tier.
I will choose T2 micro as the instance
type.
Proceed without a key pair as there is no
need for SSH.
I'll create a new security group to allow
HTTP access from anywhere.
Let's scroll down.
Let me add EC 2 user data to install a web
server and an index.html
I'm going to launch this instance now.
This EC2 instance is getting launched in
the Mumbai AWS region.
Now we have 2 EC2 instances running.
One is running in the Northern Virginia
AWS region, and the other is running in
the
Mumbai AWS region.
Let's use the IP address of the EC2
instance of the Northern Virginia AWS
region to
see if it's working as expected.
It displays Hello World from Northern
Virginia AWS region, which is good.
Let's access the one running in the Mumbai
region, get the server's IP address.
As you can see, the Mumbai EC2 instance is
displaying Hello world from Mumbai AWS
region, which is good.
So both of these instances are running
fine.
Now let's go to Route 53.
Click on create Record.
For the record name, it will be www and
the DNS name is pre-populated.
The record type will be a record.
For value, I'll use the public IP address
of the EC2 instance running in the
Northern
Virginia region.
Let me get the public IP address of the
instance.
Routing policy, I'll select latency based.
What it means is that the request will be
routed to the EC2 instance that will
have the least latency between both of
these running EC2 instances.
For the region, let me select the Northern
Virginia AWS region.
For record ID, I can say EC2 instance in
the Northern Virginia region.
Add another record.
This will be for the EC2 instance running
in the Mumbai AWS region for record name
www.na-training.com.
It will be a record like the previous one.
IP address.
Let me find the public IP address of the
instance.
Routing policy is latency for the region.
Let me select Mumbai region.
For record ID, EC2 instance in Mumbai
region, as you can notice for the domain
name
www.nada-training.com, we have two
records, means
both these IP addresses are pointing to
the same domain name.
And Route 53 will decide based on latency
which IP address the input traffic should
be
sent to.
Let's click on create Record.
As you can see, there are two A records.
The routing policy is latency-based.
Now I should go ahead and test this.
Let me go to www.na-training.com and press
enter
As you can notice, it displays Hello World
from the Northern Virginia AWS region.
The Route 53 routing policy sends traffic
to this web server because the Northern
Virginia AWS
region is closest to my location.
Now let me use a VPN to connect to Mumbai
in India so that we can
test the other server to see if the
request from India is routed to the Mumbai
server or not by Route 53.
Now let me open a new private Chrome
browser session.
As you can notice, it displayed Hello
World from Mumbai AWS region.
As this is the server running in the
Mumbai AWS region, Route 53 is routing it
to the web server instance running in
Mumbai, as opposed to the one running in
the
Northern Virginia region.
The reason is that routing to Mumbai will
provide the least latency compared to
routing the
request to the web server running in the
Northern Virginia region.
In another example, if any other user is
trying to connect, say, from Singapore,
Route
53 will direct the request to the web
server running in the Mumbai region
because of
the least latency compared to the web
server running in the Northern Virginia
AWS region.
On the same token, if someone connects
from, say, California.
Route 53 will route the request to the
Northern Virginia server as routing to the
Northern
Virginia server will provide the least
latency compared to the one running in the
Mumbai AWS
region.
I think you have got good understanding of
latency-based Route 53 routing.
Now make sure to terminate the running EC2
instances for this tutorial.
And delete hosted zone as it will cost per
month.
For the domain name, if you don't want to
use it next year, make sure to
turn off the auto renewal option.
There are other types of Route 53 routing
types as well.
Now since I hope you have got good
understanding of latency-based Route 53
routing, it should
help you to understand other Route 53
routing types with much ease.
That's it for this lecture.
Hope you liked it.