Buliding Static Website Using AWS S3

Buliding Static Website Using AWS S3

Introduction

This is Document will describe how to host a static website using amazon S3

Terms used in the document

Amazon simple storage service S3

Amazon Route 53

Creating Bucket In AWS

Steps:

  • Login into the AWS console
  • Navigate S3 service
  • Create a bucket with same name of your Domain name

For example, if you domain is test.com then create a bucket in AWS S3 as test.com

  • In this case we creating bucket as test.omniwyse.co.in
  • Select the bucket, navigate to properties and select to static web hosting

s1.JPG

  • The console looks like

s2.JPG

  • Select Use this bucket to host a website
  • Upload Index.html for home page
  • Upload error.html as error page (optional)
  • Ensure that everything hosted in this must be permitted to use publicly
  • To achieve this, create a bucket policy
  • Click on permissions tab select bucket policy

s3.JPG

 

  • Paste the following replacing with your own bucket name

{

“Version”:”2012-10-17″,

“Statement”:[{

“Sid”:”PublicReadGetObject”,

“Effect”:”Allow”,

“Principal”: “*”,

“Action”:[“s3:GetObject”],

“Resource”:[“arn:aws:s3:::test.omniwyse.co.in/*”

]

}

]

}

Create a Second bucket as www.test.omniwyse.co.in

  • Create a second bucket as test.omniwyse.co.in to redirect request from www.test.omniwyse.co.in to test.omniwyse.co.in
  • Select the create bucket and navigate to the properties and go to static web hosting section

s4.JPG

  • Select Redirect request tab
  • Enter target bucket as test.omniwyse.co.in (origin bucket)
  • This will redirect the requests from test.omniwyse.co.in to test.omniwyse.co.in
  • Click Save
  • Note the endpoint URLs for both buckets you will notice same output

Linking our static website to our Domain using AWS route 53 service

  • Navigate to Route53 service in aws
  • Create a hosted zone as omniwyse.co.in (replace with your domain name)
  • Copy the NS servers provided by AWS into your Domain Provider if your bought domain from vendors like GoDaddy, Digital ocean
  • Leave as defaults if your domain is registered in AWS
  • Create a record set as test.omniwyse.co.in (replace with your domain name)
  • Select Alias to Yes
  • Enter s3 bucket you have created

s5.JPG

Conclusion

Thus we created a static website using AWS S3 and linking it to our Custom domain name

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s