Amazon web service is one of the leading cloud platform by amazon that offers flexible, reliable, scalable, easy-to-use and cost-effective cloud computing solutions. The platform is developed with a combination of infrastructure as a service (IaaS), platform as a service (PaaS) and packaged software as a service (SaaS) offerings.

Amazon S3 or Amazon Simple Storage Service is a service offered by Amazon Web Services that provides object storage through a web service interface. We can host a static website in S3.

Step 1: Create an S3 bucket

We can create an s3 bucket with a unique name  in a region. You can change region as your wish, here i am selecting EU region and click next. These bucket name must exactly match your domain name.

Here i am choosing a domain "itsmeman.ml" and create a bucket .

Step 2: Enable static website hosting

You will need to enable the Static Website Hosting option for the S3 bucket so that the static content can be served when accessed over the internet with the endpoint URL.

Click your s3 bucket

and select properties and enable static website hosting

give the following values and save

Step 3: Upload your website code to your S3 bucket

Next you can upload your code to bucket, Make sure your default index filename is configured as the index document for your bucket. Similarly, your default error filename should be configured as the error document for the bucket.

Step 4: Edit block public access settings

Here we hosting a website so the bucket need to be access publically , so we want to select the appropriate bucket policies and enable the Public Read permissions for the bucket. Edit the "Block all public access" and  give public access.

uncheck the tick mark and save

Then confirm

Step 5: Make bucket public

After you edit S3 Block Public Access settings, you can add a bucket policy to grant public read access to your bucket. When you grant public read access, anyone on the internet can access your bucket.

Don't forget to change my arn.Use your bucket arn instead of mine .it can be found here

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::itsmeman.ml/*"
            ]
        }
    ]
}

copy above code and attach it to bucket and create bucket policy

save it and you will see this mark

Step 6 : Access your static website through S3 endpoint.

find the bucket endpoint  and access it

when accessing  http://itsmeman.ml.s3-website-eu-west-1.amazonaws.com  i got

Step 7 : Use a domain

Now we want to access the website through a domain.

For this we are going to use aws Route 53. Register a domain in Route 53 or verify a domain in route 53, then add  A record for your domain name as the bucket alias record.

create a hosted zone in route 53

then change your domain NS records in domain control panel

after changing NS records we can add an alias to s3 bucket.

add a record in hosted zone and select following options and define simple record and create record set.

At last browse our domain in a browser  itsmeman.ml

Now we  have hosted a static website in S3.