top of page
Writer's picturezealous-tech

How to create a static website on AWS S3

As you know you can use AWS for free for a year, but do you know, you can utilize it to do some interesting things like hosting a website?


Yes, you can host a free static website on AWS for years. You will be charged only if your website hits reaches to it’s free limit which is very rare.


Today you will learn how to host a static website on S3 bucket for free.

I am assuming that you do have a AWS account already and if you don’t have, no worries, you can create a free AWS account any time.


To Dos:

  • Login to AWS account and go to S3 services.

  • Create new bucket for putting your website files

  • Provide the bucket name (my-static-website-for-me) and Region (Asia pacific (Mumbai))

  • Click on Next and in the Configuration tab, enable versioning to keep previous versions as well if in case of any time you need to revert back to previous versions.

  • Now assign the Tags (you can see in above picture)

  • If you want you can enable object level logging, which may increase your bucket size and may charge you in future for those

  • Next, set up the bucket permissions, as we are hosting a static website, we need to provide the public access to the bucket, so uncheck the “Block all public access” check mark.

  • It will popup an acknowledgement as we are allowing public access to the bucket.

  • Acknowledge that and click on next


  • Review your changes and click on create bucket to create your bucket



  • Now go inside or open the newly created bucket. Here in the permission tab, you will have to write the bucket policy which will allow your files to be accessible from the web.

  • Write down the below code, only changes is that, you have to mention your bucket name at “Your-Bucket-Name-Here”;


{
 "Version": "2012-10-17",
 "Statement": [
  {
  "Sid": "PublicReadGetObject",
  "Effect": "Allow",
  "Principal": "*",
  "Action": "s3:GetObject",
  "Resource": "arn:aws:s3:::Your-Bucket-Name-Here/*"
  }
 ]
}


  • Now, switch to properties tab and click on third box ”Static Website Hosting”



  • Click on first option “use this bucket to host a website”

  • If you are using HTML, provide the name as index.html in “index document” blck.

  • You can leave the error document blank if you don’t have it.

  • Here on the top, you can see the Endpoint URL of your bucket, copy that.

  • Save the changes and you are done with the configuration part.

  • Now, Click on the upload button and upload your website related file and folders here.

 

73 views0 comments

Recent Posts

See All

Comments


bottom of page