DEV Community

Cover image for How I Hosted My Static Website on Amazon S3 Using the AWS Console
Stephen Lawal
Stephen Lawal

Posted on

How I Hosted My Static Website on Amazon S3 Using the AWS Console

As I continue learning cloud computing and getting hands-on with AWS, I decided to host a simple static website using Amazon S3. Since my website only contains HTML and CSS, S3’s static website hosting was the perfect solution—no need for servers or backend configurations. In this article, I’ll share exactly how I set it up using the AWS Management Console.

Why I Chose Amazon S3

I wanted a cost-effective and easy-to-manage way to host a simple website. After researching different hosting options, S3 stood out because:

  1. It's affordable-I only pay for what I use.
  2. It's easy to set up-no need to configure web servers.
  3. It's scalable-AWS handles traffic fluctuations automatically.

With that in mind, I jumped right into the setup.

Step 1: Creating an S3 Bucket

1. Logging into AWS
First, I logged into the AWS Management Console and searched for S3
in the AWS services menu.
2. Creating the Bucket

  • Clicked "Create bucket". Image description
  • Selected my preferred AWS region. Image description
  • Disabled "Block all public access" (since I wanted my website to be public). Image description
  • Clicked "Create bucket" to finish the setup. Image description

At this point, my storage space was ready, but I still needed to upload my website files.

Step 2: Uploading My Website Files

  1. Opened my new S3 bucket. Image description
  2. Clicked "Upload". Image description
  3. Clicked "Add files" and selected my index.html and image folder. Image description
  4. Clicked "Upload" to store them in S3. Image description

Now, my files were in the cloud, but the website wasn’t live yet.

Step 3: Enabling Static Website Hosting

To make my website accessible via a URL, I had to enable static website hosting:

  1. Opened the Properties tab in my S3 bucket. Image description
  2. Scrolled down to Static website hosting and clicked Edit. Image description
  3. Selected "Enable". Image description
  4. Chose "Host a static website". Image description
  5. Entered s3.html as my Index document. Image description
  6. Clicked Save changes. Image description

After enabling this, AWS provided me with a website endpoint URL, something like this: http://stephenbucket.s3.us-east-1.amazonaws.com/s3.html

However, when I tried opening the link, I got an Access Denied error. That meant I needed to allow public access to my files.

Step 4: Making My Website Public

By default, all S3 files are private, so I had to update permissions.
1. Adjusting Bucket Permissions

  • Opened the Permissions tab in my S3 bucket. Image description
  • Clicked Edit under Block public access settings. Image description
  • Unchecked "Block all public access". Image description
  • Confirmed the change by typing confirm and clicked Save changes. Image description

2. Changing Object Permissions
Even though I updated the bucket settings, my files were still private. I had to manually make them public:

  1. Went back to the Objects tab. Image description
  2. Selected my s3.html file. Image description
  3. Clicked "Actions" > "Make public". Image description

Now, my website was accessible to the public!

Step 5: Testing My Website

To verify everything was working, I:

  1. Opened a browser. Image description
  2. Pasted the S3 website URL from Step 3. Image description
  3. Saw my website load successfully! Image description

It was a great feeling to see my work live on the internet, hosted entirely on AWS.

Final Thoughts

Hosting a static website on S3 was a smooth experience, and I learned a lot about AWS in the process. The AWS Management Console made it easy to:

  1. Create and configure an S3 bucket.
  2. Upload and manage website files.
  3. Enable public access for website hosting.

If you’re also exploring AWS, I highly recommend trying this out. It’s a simple yet powerful way to get hands-on cloud experience.

Retry later

Top comments (0)

Retry later
Retry later