DEV Community

Cover image for Day 39: Hosting a Static Website on AWS S3
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

Day 39: Hosting a Static Website on AWS S3

Lab Information

The Nautilus DevOps team has been tasked with creating an internal information portal for public access. As part of this project, they need to host a static website on AWS using an S3 bucket. The S3 bucket must be configured for public access to allow external users to access the static website directly via the S3 website URL.

Task Requirements:

Create an S3 bucket named nautilus-web-18747.
Configure the S3 bucket for static website hosting with index.html as the index document.
Allow public access to the bucket so that the website is publicly accessible.
Upload the index.html file from the /root/ directory of the AWS client host to the S3 bucket.
Verify that the website is accessible directly through the S3 website URL.

Lab Solutions

Step 1: Create the S3 Bucket

Log in to the AWS Management Console

Navigate to S3 → Create bucket

Bucket Configuration

Bucket name:

nautilus-web-18747

Region: Same as aws-client (recommended)

Object Ownership: ACLs disabled

Block Public Access:
❌ Uncheck “Block all public access”

Acknowledge the public access warning

Leave other settings as default

Click Create bucket

Step 2: Enable Static Website Hosting

Open the bucket nautilus-web-18747

Go to the Properties tab

Scroll to Static website hosting

Click Edit

Settings

Enable: Static website hosting

Hosting type: Host a static website

Index document:

index.html

Click Save changes

Copy the Bucket website endpoint (used later)

Step 3: Allow Public Read Access (Bucket Policy)

Go to the Permissions tab of the bucket

Open Bucket policy

Paste the following policy (replace bucket name if needed):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::nautilus-web-18747/*"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Click Save changes

✅ This allows public users to read website files.

Step 4: Upload index.html from aws-client

Log in to the aws-client host

# Verify file exists:
ls /root/index.html

# Upload the file:
aws s3 cp /root/index.html s3://nautilus-web-18747/


# Confirm upload:
aws s3 ls s3://nautilus-web-18747/

Enter fullscreen mode Exit fullscreen mode

You should see:

index.html

Step 5: Verify Website Access

Open a browser

Paste the S3 Website Endpoint:

http://nautilus-web-18747.s3-website-.amazonaws.com

You should see the content of index.html


Resources & Next Steps
📦 Full Code Repository: KodeKloud Learning Labs
📖 More Deep Dives: Whispering Cloud Insights - Read other technical articles
💬 Join Discussion: DEV Community - Share your thoughts and questions
💼 Let's Connect: LinkedIn - I'd love to connect with you

Credits
• All labs are from: KodeKloud
• I sincerely appreciate your provision of these valuable resources.

Top comments (0)