Skip to main content

Command Palette

Search for a command to run...

How to Deploy a Static Website on Amazon S3 (Simple Storage Service)

Updated
2 min read
How to Deploy a Static Website on Amazon S3 (Simple Storage Service)

Deploying a static website on Amazon S3 involves creating a bucket, uploading your website files, and configuring the bucket to serve the website. Here are the steps to do this:

First, navigate to S3 and create an S3 bucket.

Enter a unique bucket name. The bucket name must be globally unique.

Uncheck “Block all public access” and check the acknowledge

Bucket Versioning is your choice. Read more about Bucket Versioning “https://docs.aws.amazon.com/AmazonS3/latest/userguide/versioning-workflows.html

Other settings are default.

This is my sample static webpage.

Now, let’s upload that file to S3.

  • Click on the “Upload” button.

  • Add the files or folders of your static website.

  • Click “Upload” to start uploading the files.

Let’s configure the Bucket for Static Website Hosting

  • In your bucket, go to the “Properties” tab.

  • Scroll down to the “Static website hosting” section and Click “Edit”.

  • Select “Enable” for Static website hosting. If you uploaded with file, just specify the index document (e.g., ‘index.html’) or if you uploaded with folder, specity the index document in the folder (e.g., ‘your-folder-name/index.html’).
  • Optionally, you can also specify an error document (e.g., ‘error.html’). And then Click “Save changes”.

You’ll see your Bucket website endpoint. It is the URL for your website. Let’s check the URL.

It’s not an error. You need to set permission of your bucket.

  • Go to the “Permissions” tab of your bucket.

  • Under “Bucket policy”, click on “Edit”.

  • Click on “Policy generator”.
  • Copy your Bucket ARN.

  • Select “S3 Bucket Policy”
  • Effect — “Allow”
  • Principal — “*”
  • Actions — “GetObject”
  • Enter your Bucket ARN with “/*”- “e.g,. your-arn/*”
  • And then click “Add Statement” and “Generate Policy”

Copy the Policy JSON Document and Paste in S3 Policy Box.

And then Save the Policy.

Let’s check again the URL.

Thank you for following along with my tutorial on deploying a static website using Amazon S3. I hope that this guide has provided you with clear and actionable steps to get your website up and running.

More from this blog

L

Linn Latt Oo

10 posts