Skip to main content

Chapter IV: 4.7 Create Static Web in S3

This document describes how to create a static web in S3, Static Web Hosting feature allows you to host your static website on Deka Box. Follow these steps to create your static web on Deka Box.

  • We need to create an index document for your static web and upload it. An index document is a web page, which is sometimes referred to as the default page.

    • Create an index.html file. if you don’t have an index.html file, you can use the following HTML to create one:
<!doctype html>
<html>
  <head>
     <title>This is the title of the webpage!</title>
  </head>
  <body>
     <p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
  </body>
</html>

Save the index file locally.

  • Upload your index.html file to your bucket.

  • After that, we need configure bucket policy to allow anonymous to access the static web.

  • Open S3 Browser on your computer.


Image 4.30 S3 Browser



  • On the S3 browser, click bucket, then select Edit Bucket Policy. We need to allow anonymous to access the static web.


Image 4.31 S3 Browser - Edit Bucket Policy



  • On the Bucket Policy Editor, create a policy syntax like the following example.
{
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": [
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "urn:sgws:s3:::test-bucket",
        "urn:sgws:s3:::test-bucket/*"
      ]
    }
  ]
}

PLEASE NOTE: Customize test-bucket with your bucket name.


Image 4.32 Bucket Policy Editor




Image 4.33 Browser - URL



  • Now the bucket host your static web.
×