Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 1.37 KB

SETUP_S3.md

File metadata and controls

37 lines (31 loc) · 1.37 KB

Steps to setup AWS S3 bucket for static hosting

  1. Navigate to S3 bucket home page
  2. Click "Create Bucket" link on top
  3. Input the bucket name and untick the "Block all public access" checkbox, and click "Create Bucket" button
  4. The new bucket will be visible in S3 bucket listing. Click on the bucket name to explore it
  5. Inside the bucket view click on the Properties tab
  6. Then click on the Static website hosting option
  7. Select radio button for "Use this bucket to host a website"
  8. Enter Index document as index.html and Error document as 404/index.html and click Save
  9. Now open Permissions tab
  10. Edit the Block Public Access setting
  11. Untick Block all public access checkbox and click Save
  12. Now navigate to Bucket Policy tab and copy paste the below snippet over there, and replace the bucket name with your bucket name
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::your-bucket-name/*"
    }
  ]
}
  1. Click Save

Setting up CDN

Serving resources through S3 bucket directly is not recommended. You should ideally serve all assets through a CDN.

See the CDN setup guide to setup the CloudFront CDN on AWS.