Route 53

Route 53 is a really powerful dns service offered by AWS. In this section, we're going to buy a domain name and set it up a hosted zone in Route 53. This will allow us to use DNS features with any resouces we setup in this course.

You can buy a domain name from wherever you want, but I personally use Namecheap, so all my examples will be using a Namecheap domain.

Production Hosted Zone

step 1:

Login to the Production account

Login to the **Production** account
step 2:

Navigate to the Route 53 console

Navigate to the Route 53 console
step 3:

Click on Get started

Click on Get started
step 4:

Create a new hosted zone

Create a new hosted zone
step 5:

Search for a new domain name and buy it. Use any service you like. Namecheap is fine.

Search for a new domain name and buy it. Use any service you like. [Namecheap](https://namecheap....
step 6:

Input your new domain name into the hosted zone and create the hosted zone

Input your new domain name into the hosted zone and create the hosted zone

This is your new hosted zone. You'll need the NS values for the next step.

step 7:

Back in namecheap, or wherever you purchased your domain, navigate to the nameserver settings and add the custom AWS name servers.

Back in namecheap, or wherever you purchased your domain, navigate to the nameserver settings and...

Once you save these name servers, your hosted zone is all setup. You are now able to start using your new domain name however you like.

But currently this domain can only be used from the production account. When we're developing apps, it's nice to be able to use dev.domain.com or other subdomains when testing things out.

Playground hosted zone

step 8:

Login to the Playground account

Login to the **Playground** account
step 9:

Navigate to Route 53 and create a hosted zone in the Playground account

Navigate to Route 53 and create a hosted zone in the Playground account
step 10:

use "play.your.domain" as the hosted zone name. Replace "your.domain" with your actual domain name.

use "play.your.domain" as the hosted zone name
step 11:

Copy the nameserver values

Copy the nameserver values
step 12:

Head back over to the production account

Head back over to the production account
step 13:

Click on Route 53

Click on Route 53
step 14:

Select your hosted zone

Select your hosted zone
step 15:

Click on Create record

Click on Create record
step 16:

Type "play"

Type "play"
step 17:

Select NS – Name servers for a hosted zone

Select NS – Name servers for a hosted zone
step 18:

Paste in the name server values from the play account, and click Create records

Paste in the name server values from the play account, and click **Create records**

Your production hosted zone should look something like this

Now you can use your.domain from the production account and play.your.domain from the playground account.

You could do the same for the development account, but we won't need that for now.

Show timestamps
00:00
Route 53 is a really powerful DNS service offered by AWS, and it integrates
00:06
really well with all the other services within AWS. So I want us to set up Route 53
00:11
right now with a domain name so that we can use it for the rest of the course and integrate it
00:16
with any other services that we set up. For this, we're actually going to start in the production
00:20
account instead of the playground account, which we'll be using mostly in this course, because I
00:25
want us to set up a domain name in the production account. This will allow you to then use that
00:30
domain name for any production infrastructure you want to set up, and we'll set up a
00:33
subdomain in the playground account so that we can still
00:37
play around with DNS without using the main domain name.
00:41
So in the production account—that's what I'm in right now—we're going to go over to Route 53,
00:47
and we can just click on Get Started over here. What we're going to be doing is setting up
00:52
a hosted zone. Right now, we can register a domain in Route 53. We can purchase the
00:58
domain through AWS. I'm not going to do that right now, but I will just click on Get Started
01:03
just so you can see what this would be like, because you could enter a domain. I could go, uh, let's
01:08
see, cloud...course, and it's going to check pricing for all of these. So here is the pricing
01:14
for cloudcourse. There's a couple of different domains. I wonder if they have .xyz, because
01:20
those are usually really cheap. If you don't want to spend a lot of money and you just need a
01:23
domain name for this course, you can always try something like a .xyz domain. Those are
01:27
usually pretty cheap. And AWS does have cloudcourse.xyz. It's fourteen US dollars.
01:32
But if I compare that with something like Namecheap—let's go cloudcourse.xyz—I can see
01:39
that I'm actually going to get that for two dollars for the first year anyway. It might retail at
01:43
thirteen ninety-eight for the years after the first one, but I can get that much cheaper for
01:47
now. So, instead of purchasing this through AWS, I generally purchase my domain somewhere
01:52
else, then set up a hosted zone in AWS for that domain name. So you could purchase this through
01:57
here—it'd be a little bit simpler—but what I'm actually going to do is go back to the
02:01
Route 53 dashboard here. If we click Get Started, we can actually just create a hosted
02:06
zone with a domain name that we purchased somewhere else. Like I said, I'm really only doing
02:10
this to save money and manage my domains in a single location. Then, when I want to use them
02:15
with AWS, I can just set up a hosted zone for them. So we're going to create a hosted zone in AWS.
02:20
And this is actually as far as we can get before we need to go buy a domain name. So I'm going to
02:24
buy my domain name through Namecheap. You could use a different provider—I use Namecheap for all
02:28
my other domain names—so really, any provider would be fine. So I'm going to go with this,
02:32
I'm going to go with cloudcourse.xyz. I'm going to add that to my cart and then
02:36
purchase that straight away. This is just two dollars for the first year. So, like I said, if you
02:40
just need a domain name to test things out for the first year, this is a really cheap way of
02:43
doing it. Now that that's been purchased, I just need to find the dashboard for whichever provider
02:48
you're using to manage that domain name. So I'm going to click this Manage button here and I should
02:52
be able to find a name server section. So, right here, I can see it's using Namecheap's basic DNS.
02:58
We're going to use custom DNS. So this is where we're actually going to head back over to AWS and
03:03
create that hosted zone. So we're in Route 53, hosted zones, create new hosted zone,
03:09
and I'm doing this in my production account. I need to enter the domain name that I just
03:14
purchased—exactly the same domain. It's probably worth just copying and pasting this to make sure
03:19
you don't get any typos. So this is cloudcourse.xyz. I'm setting up a hosted zone for my
03:24
domain name, and this is a public hosted zone. We're going to be able to use it over the public
03:28
internet. So that's all I need to do there—create hosted zone.
03:31
And hosted zones are not part of the free tier. This is going to have a monthly cost—I think it's
03:36
around fifty cents. Each month, you're going to be paying fifty cents for each Route 53
03:40
hosted zone that you have, so we're going to have one in production and one in the playground account. Now that's been created,
03:46
here we go. We should have this NS record within Route 53, and this is what we need
03:51
over here on the right. So these are the name servers we need to put in to Namecheap or whatever
03:57
you're using, which I have over here. So actually, I'm going to split these up so I can see
04:02
this better. I need to enter each of these name servers. So that's
04:06
the NS record—there's four of these values here. So I'm
04:10
going to copy them each individually. There's nameserver one...
04:14
There's nameserver two, I need to add the third one...
04:19
and then the fourth one here. I'll just click Check.
04:23
This can take a while. It could be done in a few minutes, or it could take a couple of days for
04:28
this to completely propagate, but once this is finished, my cloudcourse.xyz domain name is
04:34
going to be completely managed by Route 53. So anytime anyone makes a request to that
04:40
domain name, it's going to be resolved by Route 53 in AWS, and this will make it really
04:46
easy to integrate that into any service that we use within AWS. That's the hosted zone set up in
04:52
the production account, and I now want to set up a second hosted zone in the playground account so
04:57
that we can use a playground version of this domain name. So I'm actually going to close this
05:03
production account window and head into my playground account.
05:07
Inside the playground account, I'm kind of going to do the same thing. So I'm going to open up Route
05:12
53 once this loads...Route 53.
05:16
So this is the playground account, remember, and I'm going to get started and create a hosted zone
05:22
in my playground account. This time, I'm going to give a subdomain and just call this play...
05:27
dot cloudcourse.xyz. So the subdomain here is just play dot. It can be any subdomain, but
05:34
I'm just going to stick with play dot. Then we're going to create this hosted zone. It has to be a sub
05:38
domain of the exact domain you just made, but any subdomain will work. Then I'm going to scroll down again.
05:45
It might be zoomed in too much. I'm going to grab these NS records again. So this is just like
05:51
before, but we're not going to input these into Namecheap, because now all DNS things for all these
05:56
subdomains are going to be managed by the production hosted zone. So what I'm going to do is copy
06:01
all of these values, close the playground account again, and go back
06:05
to the production account and back into that hosted zone for the production domain. So I'll go
06:11
Route 53, then go into my hosted zones and select that cloudcourse.xyz
06:17
hosted zone, and I'm going to create a record.
06:21
This is going to be an NS record, which in the dropdown menu is right here—NS, name servers for
06:27
a hosted zone—but I can't select it because I haven't entered a subdomain yet. So I'm going to enter
06:30
the exact same subdomain, whatever I called that—play. So it's play.cloudcourse.xyz, and
06:36
now I should be able to select NS right there. So this is NS, name servers for the hosted
06:41
zone, and then I'm going to paste in all those values. These are the nameserver values from the
06:46
playground account. So now, anytime we're trying to resolve the domain name cloudcourse.xyz,
06:51
it's going to be managed by this production account hosted zone. And what we're saying here is that
06:54
anytime we try to resolve play.cloudcourse.xyz or any subdomain of that, we're actually
06:59
going to use the playground hosted zone. So all of those requests will be handled by the playground
07:03
account's hosted zone. We can create these records here. Now that should all be done, so the
07:09
production account's hosted zone will look like that, and the playground account hosted zone will
07:13
just have the one set of nameserver records. Now we're able to start working with Route
07:17
53 in both of those accounts. Like I said, it might take a little while for the name
07:22
servers to propagate before we can fully use this, but we can check if it's working. So, after
07:28
you've completed the Route 53 section, you can head over to the assessment part after
07:33
and run cloudcourse run setup-route53 to check that everything has actually been set
07:37
up correctly. So, over in Terminal, I am just going to run this command, and I need to select
07:44
both my playground and my production accounts here. Uh, this is common—it's been a little while
07:50
since I've logged in. So, let's log back into AWS with aws sso login. And now, let's try running
07:57
that again. I need this to be the playground and the production accounts, and then I'm going to
08:01
select the production zone here. So, let's form without play. It's saying that the NS records
08:06
are wrong, which could happen for a few reasons. It hasn't propagated yet. If I run `dig NS`, then I
08:13
can see, yeah, it doesn't have the right nameserver records.
08:16
This could happen. It could just take a little bit of time for this to work, but if you
08:21
set up your domain name with somewhere like Namecheap, you should double check your account
08:26
to make sure there aren't any issues with your account, like if there were any payment
08:30
issues or identification issues, Namecheap might actually not allow your nameservers to be
08:36
changed. So, you should double check that. I'm pretty sure in this case it might just be a timing
08:41
thing or I might have to go check my Namecheap account. We'll see—I took a little break and then
08:45
just ran dig NS against the domain name again and it looks like everything's looking pretty good.
08:51
So I'm going to try running the cloudcourse CLI again, selecting playground and production, and then
08:56
I'll select the production version, and it's just going to check again to make sure everything's good.
09:02
And yeah, it's looking like those were set up correctly, so we're good to go now. If I go back
09:06
to cloudcourse, I can see that, yeah, I have done everything correctly for this part. So now I'm ready to move on to the next section.