Page cover image

Create Static Web in S3

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

  • We need to create an index document for your static web and upload it. Index documents are web pages, which are referred to as default pages.

  • 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 to configure the bucket policy to allow anonymous static web access. Open S3 Browser on your computer.

S3 Browser
  • In S3 Browser, click Buckets, then select Edit Bucket Policy. We need to allow anonymous to access the static web.

S3 Browser - Edit Bucket Policy
  • In 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:::bucket-ubuntu",
        "urn:sgws:s3:::bucket-ubuntu/*"
      ]
    }
  ]
}
Bucket Policy Editor
  • Test your static web access using a URL, as an example

https://bucket.cloud.lintasarta.co.id:8082/bukcket-ubuntu/index.html
Browser - URL
  • Now the bucket hosts your static web.

Last updated