How To Host S3 Static Website With Custom Route 53 Domain (4 Min) | AWS | Set Alias To S3 Endpoint

Gokce DB
31 Mar 202304:10

Summary

TLDRIn this tutorial, ABI from gokjdb demonstrates how to host a static website using Amazon S3 and Route 53 with a custom domain. The video guides viewers through creating an S3 bucket with the same name as the domain, uploading an index.html file, configuring the bucket for static website hosting, and making the objects public. It also covers setting up a Route 53 record with the custom domain to point to the S3 bucket, ensuring the website is accessible via the custom domain. The video concludes with a reminder to check for the DNS change to sync and a prompt for likes, subscriptions, and notifications.

Takeaways

  • 🌐 Start by navigating to the S3 service in AWS to create a new bucket with a name that matches your custom domain.
  • πŸ“ Leave the region as US East 1 and enable ACLs, but uncheck 'Block all public access' to make objects public.
  • 🚫 Acknowledge the warning about making all objects in the bucket public.
  • πŸ“‚ After creating the bucket, upload the index.html file which contains the website's content, such as a 'Hello World' message.
  • βš™οΈ Go to the bucket's properties, enable static website hosting, and specify 'index.html' as the index document.
  • πŸ”„ If you encounter a '403 Forbidden' error, make the index.html file public using the ACLs.
  • 🌐 Visit the Route 53 service to manage your custom domain and create a new record.
  • πŸ“ Use the same name for the record as your S3 bucket and select 'Simple Routing' for the record type.
  • πŸ”„ Choose 'Alias' for the record type and link it to the S3 website endpoint you created earlier.
  • πŸ“ Select the correct region for the S3 endpoint and ensure the record is linked to it.
  • πŸ‘€ Wait for the DNS changes to sync and then check your custom domain in a new browser to confirm it's routing to the S3 endpoint.

Q & A

  • What is the main topic of the video?

    -The video is about teaching viewers how to host a static website using Amazon S3 with a custom Route 53 domain in AWS.

  • What is the first step in creating a static website on S3?

    -The first step is to navigate to the S3 service and click on 'create bucket', giving it a name that matches your custom domain.

  • Why is it important to choose the correct region for the S3 bucket?

    -Choosing the correct region ensures that your website's data is stored and served from a location that is geographically close to your audience, which can improve load times.

  • What does enabling ACLs mean in the context of the S3 bucket?

    -Enabling ACLs (Access Control Lists) allows you to control who has access to the bucket and its contents.

  • Why should you uncheck 'Block all public access' when creating the S3 bucket?

    -Unchecking 'Block all public access' is necessary because the video tutorial requires the bucket's objects to be public for the website to be accessible.

  • What file is uploaded to the S3 bucket to serve as the website's homepage?

    -An 'index.html' file is uploaded, which contains the content to be displayed on the homepage of the website.

  • How do you enable static website hosting for the S3 bucket?

    -You navigate to the 'properties' tab of the bucket, scroll down to the 'static website hosting' section, click 'edit', enable static website hosting, and specify the index document name.

  • What is the purpose of the 'make public using ACL' action on the S3 objects?

    -The 'make public using ACL' action is used to grant public access to the objects in the bucket, which is required to resolve the 403 Forbidden error and make the website accessible.

  • What is the process for creating a record in Route 53 to link the custom domain to the S3 bucket?

    -You navigate to the 'hosted zones' in Route 53, select your hosted zone, click 'create record', choose 'simple routing', define the record with the same name as the S3 bucket, set the record type to 'A' or 'Alias', and choose the S3 website endpoint as the Alias target.

  • Why is it necessary to wait for the Route 53 changes to be 'in sync'?

    -Waiting for the changes to be 'in sync' ensures that the DNS propagation is complete and the custom domain is correctly pointing to the S3 bucket before testing the website.

  • How can you confirm that the custom domain is correctly routing to the S3 endpoint?

    -You can confirm this by opening a new browser session and visiting your custom domain to see if it displays the content of the S3 bucket's static website.

Outlines

00:00

🌐 Hosting a Static Website on S3 with Custom Domain

ABI from gokjdb introduces viewers to the process of hosting a static website using Amazon Web Services (AWS). The tutorial begins with creating an S3 bucket with a name that matches the custom domain. The bucket is set up in the US East 1 region with ACLs enabled but public access blocked. The video demonstrates uploading an 'index.html' file, which contains a simple 'Hello World' message in H1 tags. The properties of the bucket are then configured for static website hosting, with the index document specified. The tutorial also covers resolving a 403 Forbidden error by making the objects public through ACLs and verifying the website's accessibility.

πŸ”„ Configuring Route 53 for Custom Domain Routing

Continuing the tutorial, the video script explains how to set up a custom domain with Amazon Route 53. This involves navigating to the hosted zones and creating a record that matches the S3 bucket name. The record type is set to A or Alias, and the endpoint is configured as an Alias to the S3 website endpoint. The region is selected as US East 1, and the S3 endpoint is automatically populated. After creating the record, the status is monitored until it changes from 'Pending' to 'In Sync'. The final step is to confirm in a new browser session that the custom domain is correctly routing to the S3 endpoint, completing the setup process.

Mindmap

Keywords

πŸ’‘S3

S3 stands for Simple Storage Service, which is a service provided by Amazon Web Services (AWS) for storing and retrieving any amount of data, at any time, from anywhere on the web. In the video, S3 is used to host a static website, which is a website that does not require server-side processing and can be served directly from the S3 bucket.

πŸ’‘Custom Domain

A custom domain refers to a domain name that is unique to the owner and is used to identify a website on the internet. In the script, the custom domain is 'testing.gokjdb.com', which is used to access the static website hosted on S3.

πŸ’‘Route 53

Route 53 is a highly available and scalable Domain Name System (DNS) web service provided by AWS. It is used to route users to the website by translating human-friendly domain names, such as 'testing.gokjdb.com', into IP addresses that computers use to connect to each other on the internet.

πŸ’‘Bucket

In the context of AWS S3, a bucket is a basic container that holds your data. The video script describes creating a bucket with a specific name that matches the custom domain, which is essential for hosting the static website.

πŸ’‘ACLs (Access Control Lists)

Access Control Lists (ACLs) are used to define permissions for Amazon S3 buckets and objects. In the script, ACLs are enabled but with a note of caution to uncheck 'block all public access', which is important for the bucket to be accessible over the internet.

πŸ’‘Static Website Hosting

Static website hosting refers to the service provided by AWS S3 to host websites that consist of static HTML, CSS, and JavaScript files. The script explains how to enable this feature for an S3 bucket to serve the website's content.

πŸ’‘Index Document

An index document is the main page that is served when a visitor accesses the root URL of a website. In the video, 'index.html' is specified as the index document for the static website hosted on S3.

πŸ’‘Public Access

Public access refers to the ability of anyone on the internet to view or download the content stored in an S3 bucket. The script mentions making the objects in the bucket public to resolve a '403 Forbidden' error, allowing the website to be accessible.

πŸ’‘Record

In the context of Route 53, a record is a mapping between a domain name and an IP address. The script describes creating a record in Route 53 to point the custom domain to the S3 bucket's website endpoint.

πŸ’‘Alias

An alias in Route 53 is a type of record that points a domain to another resource, such as an S3 bucket, without changing the domain's IP address. The script uses an alias record to direct the custom domain to the S3 bucket's website endpoint.

πŸ’‘DNS Propagation

DNS propagation refers to the time it takes for changes made to the DNS records to take effect worldwide. The script mentions waiting for the DNS changes to go from 'pending' to 'in sync', which is necessary for the custom domain to correctly route to the S3 bucket.

Highlights

Introduction to hosting a static website using S3 with a custom Route 53 domain in AWS.

Navigating to the S3 service and creating a new bucket with a name matching the custom domain.

Choosing the correct region and enabling ACLs while configuring the bucket.

Disabling 'Block all public access' and acknowledging the warning about making objects public.

Uploading the index.html file to the S3 bucket for the website.

Setting up the properties for static website hosting and specifying the index document.

Accessing the bucket website endpoint to check the website's initial accessibility.

Troubleshooting the 403 Forbidden error by making the objects public using ACL.

Refreshing the website endpoint to display the 'hello world' message after making objects public.

Moving to Route 53 service to configure the custom domain.

Creating a record in the hosted zone with the same name as the S3 bucket.

Selecting the correct record type and endpoint for the S3 website.

Choosing the appropriate region for the S3 endpoint.

Automatic population of the S3 endpoint in Route 53 and creating the record.

Checking the status of the DNS changes and waiting for them to sync.

Confirming the custom domain routing to the correct S3 endpoint in a new browser session.

Encouraging viewers to like, subscribe, and turn on notifications for future content.

Transcripts

play00:00

hi guys this is ABI from gokjdb in this

play00:03

video you're going to learn how to host

play00:06

a static website using S3 with a custom

play00:10

Route 53 domain in AWS let's get into it

play00:15

[Music]

play00:18

let's start by navigating to the S3

play00:21

service

play00:22

then click on create bucket and give it

play00:24

a name the name of the bucket needs to

play00:27

be the exact same as the name of your

play00:30

custom domain so I'm going to pick

play00:32

testing dot

play00:34

gokjdb.com let's leave the region to us

play00:38

East 1 and enable ACLS attention

play00:43

uncheck block all public access then

play00:47

acknowledge the warning that says this

play00:50

will make all objects in this bucket

play00:52

public I'm going to leave all the other

play00:55

settings to their default values then

play00:58

click on create bucket let's go inside

play01:01

our bucket and upload the

play01:04

index.html file for our website keep

play01:08

your formation

play01:09

in this file well I'm just printing

play01:12

hello world within H1 tags let's

play01:15

continue uploading this file by hitting

play01:18

the upload button

play01:19

next navigate to the properties tab then

play01:23

scroll down to the static website

play01:26

hosting section click edit enable static

play01:30

website hosting then specify the name of

play01:33

your index document in our case this

play01:37

will be

play01:38

index.html that's why

play01:42

save then go back to the static website

play01:46

hosting section

play01:47

this time you should see a bucket

play01:50

website endpoint here click on it to see

play01:53

if you can access your website

play01:55

[Music]

play01:56

[Applause]

play01:59

looks like we're getting the 403

play02:02

Forbidden error to fix that go to the

play02:05

objects tab then click on the actions

play02:08

drop down choose make public using ACL

play02:12

then hit the make public button refresh

play02:17

your website endpoint and this time you

play02:20

should see your hello world message

play02:22

[Music]

play02:25

next let's navigate to the Route 53

play02:29

service then click on hosted zones go

play02:33

inside your hosted zone for me it's

play02:35

cocktjdb.com then click on create record

play02:39

choose simple routing hit next then

play02:43

click on Define simple record for record

play02:47

name it needs to be the same as our S3

play02:50

bucket so in this case it should be

play02:53

testing Dot gokudb.com

play02:56

leave the record type to a or Alias and

play03:00

for endpoint choose Alias 2 S3 website

play03:05

endpoint company

play03:08

for region I'm going going to select Us

play03:11

East 1 and now if you click inside the

play03:15

S3 endpoint text box our S3 endpoint

play03:19

that we created earlier should

play03:21

automatically pop up select it then

play03:24

click on Define simple record hit create

play03:28

records then click on view status

play03:32

your change status should now say

play03:34

pending give it a few minutes

play03:39

and it should eventually change to in

play03:42

sync let's open a new browser session to

play03:46

confirm that our custom domain is now

play03:49

routing to the correct S3 endpoint

play03:52

[Music]

play04:00

and Below don't forget to like subscribe

play04:03

and turn on the notification Bell until

play04:06

next time

play04:08

ah

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
AWS HostingS3 BucketRoute 53Custom DomainStatic SiteWeb TutorialCloud StorageACL SettingsPublic AccessWeb DeploymentTech Guide