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