How to Upload Files to S3 and Host a Static Website

In this guide, you’ll learn how to upload files to an S3 bucket and configure it to host a static website (HTML/CSS/JS). This is ideal for portfolios, landing pages, or documentation.


Part 1: Create an S3 Bucket

  1. Log in to your AWS Console
  2. Search for S3 and go to the S3 dashboard
  3. Click “Create bucket”

Configure:

  • Bucket name: my-static-site (must be globally unique)
  • Region: Choose your preferred region
  • Uncheck: “Block all public access” (we’ll allow public read access)
  • Confirm you understand the public access settings

Click Create bucket


Part 2: Upload Website Files

  1. Click the bucket you just created
  2. Click “Upload”
  3. Add your HTML, CSS, images, and JS files
    • Example: index.html, style.css, images/
  4. Click Upload

Part 3: Make the Files Public

  1. Go to the Permissions tab
  2. Scroll down to Bucket policy, click Edit

Paste this policy (replace my-static-site with your bucket name):

jsonCopiarEditar{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-static-site/*"
    }
  ]
}

Click Save changes


Part 4: Enable Static Website Hosting

  1. Go to the Properties tab
  2. Scroll to Static website hosting
  3. Click Edit
  4. Enable static website hosting

Configuration:

  • Hosting type: Host a static website
  • Index document: index.html
  • (Optional) Error document: error.html

Click Save changes


Part 5: Access Your Website

  • Go back to Properties → Static website hosting
  • Copy the Endpoint URL
  • Paste it into your browser — your website is live!

Example:
http://my-static-site.s3-website-us-east-1.amazonaws.com

You May Have Missed