Skip to main content
  1. Blogs/

How I Deployed My First Static Site Using S3 Buckets

·444 words· loading ·
Sonam Tamang
Author
Sonam Tamang
Cybersecurity learner | CTF Player
Table of Contents

Background
#

As a Part of Devops Micro Intership (DMI) with Pravin Mishra, I Explore the Cloud Services , especially focusing on AWS . We have learned from basic to advance concepts of AWS services. It was very practical learning with hands on Experience with Real life projects and Assignments. As a Part of Assignment , I Learned the concept of S3 buckets and deployed my first static site on S3 buckets.

đź“© Message: If you want to learn DevOps with hands-on practice and live projects for free, you can follow the YouTube playlist by Pravin Mishra.

Deploying Static Site
#

To Deploy a Static Site using S3 Buckets, we need an AWS account . I am using AWS Free Tier account. here is a step wise step instructions that i followed to deploy my first static site on S3 buckets.

1. Create a S3 Bucket
#

  • Search the keywords,S3 Buckets in the AWS Console search bar and Select the S3 service.

    alt text

  • Select the General Purpose Buckets and Click, Create Bucket to create bucket.

    alt text

  • Create a new S3 Bucket (General Purpose) with Specific Project Name and disable the ACL.

    alt text

2. Upload Website Files
#

  • After selecting the options that we need as per our requirement, S3 buckets created successfully. Now we need to upload the source code of static application.

    alt text

  • Download the Source code of Static site from : https://html.design/download/repair-maintenance-html-template

    alt text

  • Upload the source code to the S3 bucket. You can use either the AWS CLI or the AWS Console (GUI). I used the GUI method for this project.

    alt text

alt text

3. Enable Website Hosting
#

  • Go to Properties and scroll down. You’ll see that S3 static website hosting is disabled. To enable it, click the Edit button and make the necessary changes.
    alt text
    alt text
    Enable the hosting and and select hosting type as a static hosting.
    alt text

4. Configure an website hosting
#

  • Go to Properties and configure the index and error documents for the site. We are selecting index.html as the index document and leaving the error document empty for now.

    alt text

  • Make the Changes and save the configuration,

    alt text

5. Enable Block Public Access
#

Go to Permissions and check if public access is blocked. In our case, public access is blocked. Click the Edit button and disable it.

alt text
alt text

  • Save the changes and confirm it.
    alt text

6. Setting Bucket Policy for website access
#

  • Go to Permission, scroll down, and select Bucket Policy. Click Edit and write a policy in JSON format.
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::week-4-aws/*"
    }
  ]
}

alt text

  • Click on the S3 bucket endpoint and visit the static site, the site is live now.
    alt text

7. Demo
#

alt text