Host a static website in AWS S3
Hello! I'm a student passionate about becoming a Cloud and DevOps Engineer. I have a solid foundation in AWS Cloud, Linux, Docker, and Kubernetes.
Introduction
Amazon S3 is an object storage service used to store the data and using S3 we can host our website on S3, so let just host a website in S3.
Prerequisite
aws account
domain
Configure S3 Bucket
create a S3 bucket with the same name of as of your domain
choose ACL disabled in Object Ownership.
upload index.html file and grant Public read access.

Select the bucket and go to the Properties section and Enable Static website hosting and add the name of index document, you can add an error document as well.

Route53
In you aws management console search Route53 service, in the DNS Management section click on create hosted zone.
Enter your domain name and select type of hosted zone as public then click create.

Once you created the hosted zone you will get 4 nameserver.
Update DNS
Go to your domain registrar console and for the registered domain click on option for change Nameserver.
add the 4 nameserver entry that you got after creating hosted zone.
Create Record in Route53
once nameservers are updated, back to your aws console and in the created hosted zone click on create record
select the Record type A (this type of record sends traffic to IP address, but we don't have webserver running on EC2 having public IP, we will use alias)
enable Alias and and select Alias to S3 website endpoint.
Choose S3 region (where your bucket is )
and select the S3 endpoint then click on create record.
Test your website
test your website by typing URL in the browser.

Things to Consider also
make sure that you create a bucket first before purchasing the domain, because the bucket names are globally unique.



