Check out a free preview of the full AWS For Front-End Engineers, v2 course

The "www Redirect" Lesson is part of the full, AWS For Front-End Engineers, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Steve creates a second S3 bucket to represent the "www" version of the domain. This bucket redirects to the naked domain.

Preview
Close

Transcript from the "www Redirect" Lesson

[00:00:00]
>> The other part that we might want to have is right now superawesome.clickworks. But if they go to www.superawesome click, it will not work, right?. And so we probably should handle for that I you can argue who goes to www.anymore. I'm not having that argument with you. I'm just going to fix the issue, because I'm not I agree with you, but like, I'm just trying my best not to break the web here.

[00:00:25]
So let's go ahead and set that up. So the way we're going to do this is Amazon supports the ability to have you do create a bucket that just redirects to another bucket. So basically, if we've got a mapping of a given static website hosting at this URL for this bucket we theoretically could have a domain www dot that's why we got the SSL cert for that as well before.

[00:00:51]
That goes to the routes to the bucket and route 53. That then just serves the same assets as our main bucket. We don't have to deploy out to two different buckets, maybe have two different versions of the same assets or anything along those lines. In one bucket, the second bucket that points to that bucket, and then the two domain names a bear subdomain.

[00:01:11]
Just super awesome.clique and www.superawesome.click all end up at the same set of files. So let's, let's make that happen. So we're gonna go back into s3 buckets. We will the larger set of buckets here, and we're going to create another bucket Good. This one is gonna be called www.superawesome.click.

[00:01:36]
We'll keep it in the same region. Okay, awesome. We'll just leave everything, the default for now.
>> Do we need to do allow public access?
>> Not necessarily for this one I don't think we'll find out together. I think when I haven't redirect will be fine but if we find out that it's not that, will be the thing when you tell me about it and I go it's fine and I'm like yeah.

[00:02:04]
So we've got that in place let's go down to properties We'll go to the static website hosting. Redirect request to an object and so at this point, we will go in here and we'll redirect it back to our main bucket. I guess you could technically send it to a hostname as well, but we'll do it was a kind of one in the same for us.

[00:02:35]
Awesome. So, now we've got www. And we've also got the ability to set that second bucket up. Now, if we just go to this raw bucket, let's find out the answer to your question while we're in here In here, scroll to the bottom of properties. Let's click this link.

[00:02:53]
Okay, it does just right on redirect them right to a regular bucket. So we did not need to turn on public access, like I thought, however, it's not wired up to do WWW dot because that's not something we set up in DNS, right. So we need to do now is basically I'll kind of leave this as an exercise for you can do together as well.

[00:03:12]
To kind of just go in the same process for setting up the regular route, we just need to set up for the www as well. So we go back in To route 53 Go to our domains Manage DNS, we hit Edit. Pop quiz see if we listened before, and it doesn't do anything we need to view details and we will create a record, this will be www.

[00:03:57]
Yeah, now clearly you can have different ones for your blog everything like that it will alias it to an S3 website endpoint in US East one or wherever to www.superawesome. To not click it's the only one that shows up because the other one is taken by the other alias it's not that smart that I read our minds.

[00:04:21]
Sweet so now we have that set up as well we saw that too Super awesome click worked, and so now that might take a second if you immediately go to it probably doesn't work. Let's find out not necessarily because it didn't work. It does that was fast. It's already in place and awesome.

[00:04:48]
So now we are both superawesome.click and www.super.awesome.com and clearly any other thing that you wanted to do, you could set up and make it happen

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now