Skip to content

Instantly share code, notes, and snippets.

@jeromy-vandusen-obs
Last active September 26, 2019 22:01
Show Gist options
  • Save jeromy-vandusen-obs/1f1bc24a1de6020701e415f4d6ddcd5b to your computer and use it in GitHub Desktop.
Save jeromy-vandusen-obs/1f1bc24a1de6020701e415f4d6ddcd5b to your computer and use it in GitHub Desktop.
S3 Static Website Cheat Sheet

S3 Static Website Cheat Sheet

  1. On the S3 console, click "Create bucket".
  2. On the first page, enter a unique bucket name and preferred region.
  3. On the second page, accept all default settings.
  4. On the third page, uncheck "Block all public access".
  5. On the last page, review the settings and click "Create bucket".
  6. Click into the newly created bucket, and then click "Upload" to upload your static content.
  7. Select the "Properties" tab and then click "Static website hosting".
  8. Check "Use this bucket to host a website", enter the file name of the index document, and then click "Save".
  9. Select the "Permissions" tab and then click "Bucket policy".
  10. In the "Bucket policy editor", enter the following, replacing "${BUCKET_NAME}" with the name of your bucket, then click "Save":
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::${BUCKET_NAME}/*"
        }
    ]
}

Your website is now available. To obtain the URL to your website, select the "Properties" tab, click "Static website hosting", and note the "Endpoint" URL listed at the top of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment