-: So now let's talk about the Routing Policy-Geolocation,
which is very different from Latency-based.
So, this is based on where the user is actually located.
So, for example, you can say,
if a user comes from a specific continent,
or a country, or even more precise, on the U.S. states,
and, the most precise location is going to be selected
at first, then routed to this IP.
So, you should create a default record,
in case there's going to be no match on location,
and the use case for this is going to be
for website localization,
to restrict content distribution,
do load balancing, and so on.
And these type of records can be associated
with health checks.
So the idea is that, if we have a map of Europe,
with multiple countries, we can define a geolocation record
for Germany, to see the German users should go to this IP,
which contains my German version of my app.
And if I go to France, then go to this IP,
which contains a French version of my app.
But for anywhere else, go to the default IP here,
which contains maybe the English version of my app.
So, this is how you would use a geolocation.
Now, let's go practice in the console.
Okay, so, let's go ahead, and create our first geo record.
So, I'm going to create a record, and I'm gonna make geo,
and, the record type would be A, the value of it is,
let's link it first to the ap-southeast-1.
And, what we're going to do here is going to say,
the routing policy is going to be geolocation.
And we're saying, okay, all of Asia,
so, any user located in Asia,
should go to my ap-southeast-1 EC2 instance.
We could associate a health check with it if we wanted to,
we need to give a record ID, so, here we go.
Now, let's add another two records.
So what I'm going to do is that, I'm going to say that's,
for
us-east-1.
I want to send any user from,
and, we can say geolocation yet again.
And let's say, for example, just a country,
so we can say, United States.
And, we could say lastly, so this is record ID, U.S.,
and so, as you can see here, I specified a country,
and here's specified a whole continent, it doesn't matter.
And then lastly, we'll add one more record,
here's the record name,
and the value of which, is going to be eu-central-1.
And, this one is going to be my defaults,
so, I'm going to say, geolocation,
and the location is default,
that means that anything that doesn't match Asia
or United States, is going to go to my default location,
and this one is going to be called, Default EU.
Now, it's create these records,
and they've been successfully created.
So, what I can do now is that I can test it, right?
So, currently, I am not in the U.S., and I'm not in Asia.
So, if I open this URL, I will get the eu-central-1 region,
so, this is good, that means that
this is the default record,
that is pure, that is working properly.
So now, let's change geographic location, and to do so,
I'm going to use my VPN, and now let's go to an,
a country in Asia, so let's go to India.
So, I'm now connected into India.
And, when I refresh this page now,
what I expect is to get a Hello World,
from my ap-southeast-1 instance.
Oh, as you can see, there's a, a long load,
so, I know what's happening, so, this is a timeout,
and so, whenever you see a timeout in AWS,
usually you have to think about security groups.
So, if I go to my security group,
yes, I'm in the right region, so in the Singapore region,
and look at the Inbound rules, and edit them.
If you remember, I had removed that the HTTP rule
to make the health check fail,
so, we need to add back that HTTP rule,
so, let's add it back, and it's a good edit on your screen.
So, the HTTP rule has been added back,
and so now, if I go back into this page,
as we can see, now, we get the Hello World from
ap-southeast-1b, so, the Asia thing is working.
Now, if I go to a country in the U.S.,
if I go to the United States, overall,
and, I'm in the U.S.,
and refresh, I'm going to get Hello World from us-east-1a,
so, this is perfect.
And, if I go to something right next to the U.S.,
but not in the U.S., for example, if I go to Mexico.
And refresh, as you can see, I get my eu-central-1c,
because this is my default record,
and, the Mexico was not specified as a rule
in the geolocation Route 53 record.
Okay, so this is it, this is working perfectly.
I hope you like this lecture,
and I will see you in the next lecture.