Host Static Website on s3

Host Static Website on s3 | s3 Static Website | AWS s3 Static Website

In this post you are going to learn more about Amazon Web Services (AWS) via a practical example, hosting a static website on Amazon Simple Storage Service (S3). In a few simple easy steps, you can set up your static website hosted on S3.

AWS services Use

S3 Simple Storage Service

What is AWS

AWS ( Amazon web service ) is a platform that offers flexible, reliable, scalable, easy-to-use and cost-effective cloud computing solutions.

What is S3

Amazon S3 is a Simple Storage Service is a service offered by Amazon Web Services that provides object storage through a web service interface.

Setup & Configuration of S3 ( Simple Storage Service )

  1. First Step is open you aws management console here we see many aws services now click the s3 storage
host static website on s3  | s3 static website | aws s3 static website

Setup your S3 buckets

Click the create bucket button and go to next step

host static website on s3  | s3 static website | aws s3 static website

General configuration s3 bucket

This is basic configuration of s3 bucket first type your bucket name and select you Region and uncheck the Block all public access

host static website on s3  | s3 static website | aws s3 static website

and we see a alert message our s3 storage object is publicly access click the check point button and create a bucket

our s3 bucket is successfully created now click your bucket name

Uploading Website S3 bucket

Now upload you website file click the upload button

host static website on s3  | s3 static website | aws s3 static website

and click the add files

click the upload button and upload you all files s3 storage

host static website on s3  | s3 static website | aws s3 static website

Static website hosting configure properties

Next we setup this bucket for static site hosting. You can find this under the Properties tab of the bucket

host static website on s3  | s3 static website | aws s3 static website

and here provided your defaults index file in my case my file name is index.html this time I don’t have an error document file leave the blank column and click the save button.

Set Permissions S3 Bucket

go to permissions tab

s3 static website bucket policy

copy the code and paste you bucket policy and replace example.com/ your bucket name and click save button

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::example.com/*"
            ]
        }
    ]
}
host static website on s3  | s3 static website | aws s3 static website

our s3 bucket policy is setup successful click the your default index.html file and we see the object URL copy the URL and open the URL your browser

navigate the bucket URL we see our AWS s3 static website

https://hacknos.s3.ap-south-1.amazoneaws.com/index.html
host static website on s3  | s3 static website | aws s3 static website
Free WordPress Web site host on AWS ( amazone web service ) link

About Rahul Gehlaut

Cyber Security Researcher, CTF Player. Tech Blog Writer.

View all posts by Rahul Gehlaut →