okay so we've created our CloudFront distribution and CloudFront has 2
distributed that across all of its edge locations across the globe, what we need 3
to do now is that we need to make sure that Amazon route 53 the domain name service 4
is distributing all of its traffic coming to our domain name out to 5
this cloud front distribution, so the first thing I want to do is just take a copy 6
of this domain name the cloudfront domain name and we're going to jump into 7
route 53 console, so again we go to services and route 53 and a hosted zone 8
would have already been created when we purchased that domain name 9
and so there it is and we can see there's already 10
been four records that have been created for us by AWS so we have a look at that 11
and we can see there there's a name server record and a start of authority record 12
and two cname records, so these two were created 13
when we purchased the domain name and these two here were created by the 14
certificate manager when we went through that validation process to create that 15
validation between our ownership of this domain and that certificate 16
what we need to do now is we need to create a record set for directing 17
traffic from our Apex domain which is in this case as thedevkid.com 18
yours will of course be different and we need to direct that through to our 19
cloudfront distribution, so we select an A record and it will be an alias 20
and it will go to our cloudfront distribution and so we drop down here, we click on 21
alias target, we will be able to select our cloudfront distribution and then we 22
click on create, after a certain amount of time that will propagate 23
across Internet and then when you type into your browser the apex domain 24
thedevkid com or whatever yours is, the traffic will be directed 25
through to the cloudfront distribution, so we need to create another one for the 26
www so when people go to 27
www it will be resolved to that cloudfront distribution 28
now that will take a while to propagate and Route 53 won't be 29
able to tell you when it's propagated across the internet, 30
there's a website called what's my DNS 31
and if you go there and you just put in the the domain, so I've got here 32
thedevkid.com and you want to check on the A record, just click on search 33
you can see there, I actually put this in before and it's propagated quickly 34
it's not going to propagate that quickly for you it's this is the 35
second time that I've run through this but it'll take about 15 minutes or so to 36
propagate out and we can check the www and see whether that one has started to 37
propagate or not, now that one was a cname record and we can search that as well 38
and there we go, so that was very quick actually and that's one thing 39
you'll learn about AWS is all route 53 is that if you've 40
used other DNS services route 53 is very quick and very reliable and like 41
everything with AWS it's certainly best of class 42
so that's pretty good so what we can do now is if we go to thedevkid.com, there you go 43
so that's all up and running not a problem and we've got HTTPS here so we 44
came in on HTTP and CloudFront automatically converted that over to HTTPS 45
so we're now on encrypted traffic now and we do www, it should go to the same area and 46
there we go, so www is also working, so that's pretty good, okay, so before we 47
finish up with this part of the lab I just want to give you a quick overview 48
of how to create or to invalidate a cloudfront distribution, so what I mean 49
by that is that when you create or when cloudfront creates a distribution it 50
has a time to live or a TTL and it won't be changed until that is up 51
so if you have a TTL of 24 hours it's not going to fetch new data or new information from 52
your s3 bucket in a shorter time than that, if for example you've got something 53
that's critical that needs to be updated on your website and you can't wait 24 54
hours for it to be updated what you can do is you can invalidate that 55
cloudfront distribution, you can invalidate invalidate the whole distribution or 56
just parts of it, what we do is go into cloudfront and we can click on our 57
distribution and then we can go into invalidations and then we can go in 58
create invalidation, so there's a few examples that were there but if you just 59
wanted to invalidate everything you could just do a wild-card symbol like that 60
and let invalidate everything in that in that distribution 61
if you just wanted to invalidate your main webpage you just put in index.html 62
you click on invalidate and then it will go through and after a certain 63
amount of time it'll come through like this and come through as completed 64
this is one that I did previously because it takes around about 15 minutes or so 65
to invalidate it depending on what you're invalidating, so that brings us to the end 66
of this part of the lab coming up next we're going to talk about using the 67
bucket redirection feature of s3 website hosting what that means is that we can 68
have traffic is coming in for a domain and we can 69
redirect it somewhere else which is really quite handy so you might have for 70
example if we've got you know backspace academy.com we might have .net .com.au 71
.com.br and all these ones and we want to redirect them all to the same domain 72
we can do that by creating a bucket and like what we did before and a hosting 73
bucket but we can select redirection on that bucket in a redirect everything 74
back to our main domain, so that's coming up next and I'll see you in that 75
one