Logo

dev-resources.site

for different kinds of informations.

Hosting a static Website on S3

Published at
6/12/2024
Categories
s3
aws
webhosting
awscloud
Author
bowei
Categories
4 categories in total
s3
open
aws
open
webhosting
open
awscloud
open
Author
5 person written this
bowei
open
Hosting a static Website on S3

This article will show how to host static websites via S3 buckets by simply enabling the static hosting option and applying an efficient bucket policy to allow public access.

Prerequesites

Basic knowledge of Amazon S3 and Web hosting.

Firstly, we create the S3 bucket with a globally unique name in a specified region we want.

Image description

Under the Block Public Access section, we uncheck the box to enable Public access since we are going to be hosting a static website via the bucket.

Image description

We disable Versioning and optionally, we can add tags.

Image description

Disable Server-side encryption and Create the bucket.

Image description

You should get a message like the one below;

Image description

Click on the bucket name and go to the properties Tab.

Image description

Scroll down to Static website hosting and click on Edit.

Image description

Enable Static Web hosting & host a static website. Also input an index document name, typically Index.html and save the changes.

Image description

Next, go to the permissions tab of the bucket to input a bucket policy.

Image description

Image description

Copy and paste the below bucket policy, replacing your actual bucket name with what is listed as "Bucket-name" below and save changes.

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::Bucket-Name/
"
]
}
]
}

Image description

Next, it's about time to upload the necessary documents.

Image description

Click on Add Files, add your website files one after another, and upload.

Image description

Image description

Go back to the properties tab and scroll down to find your S3 endpoint which will be used to access the website.

Image description

Image description

Click on the endpoint and the static website is now accessible.

Image description

In the simplest of forms, this is an easy way to host a static website. More features like using CloudFront and Route 53 can be factored in eventually.

awscloud Article's
30 articles in total
Favicon
How AWS Security Works: Protecting Your Cloud Infrastructure and Data
Favicon
๐€๐–๐’ ๐‚๐จ๐ฆ๐ฆ๐ฎ๐ง๐ข๐ญ๐ฒ ๐‹๐ž๐š๐๐ž๐ซ๐ฌ ๐‘๐จ๐ฎ๐ง๐๐ญ๐š๐›๐ฅ๐ž - ๐…๐ข๐ซ๐ž๐ฌ๐ข๐๐ž ๐‚๐ก๐š๐ญ ๐ฐ๐ข๐ญ๐ก ๐ƒ๐ซ.๐–๐ž๐ซ๐ง๐ž๐ซ
Favicon
Amazon Route 53: AWS's Powerful DNS Service ๐ŸŒ๐Ÿš€
Favicon
The Benefits of AWS Cloud Consulting for Seamless Cloud Migration
Favicon
AWS Lambda now supports using a custom serializer with Java runtimes
Favicon
AWS announces End User Messaging Social: bring your conversations to WhatsApp
Favicon
Amazon EC2 now supports to Optimize CPUs post instance launch
Favicon
AWS Security Hub has released 7 new security controls, increasing the total number of controls offered to 430
Favicon
Amazon Route 53 Resolver endpoints now support DNS-over-HTTPS (DoH) with Server Name Indication (SNI) validation
Favicon
Amazon CloudWatch Internet Monitor from Amazon Network Load balancer
Favicon
AWS Lambda now supports tagging of Event Source Mappings and Code Signing Config resources
Favicon
AWS Directory Service(AWS Managed Microsoft AD) adds user and group management using APIs and Console
Favicon
AWS CodeBuild now supports managed GitLab self-hosted runners
Favicon
Amazon Bedrock Model Evaluation now supports evaluating custom model import models
Favicon
Amazon EventBridge Pipes now supports customer managed KMS keys
Favicon
AmazonECS now supports AWS Graviton-based Spot compute with AWS Fargate Spot
Favicon
AWS Code Build now supports using GitHub Apps to access source repositories
Favicon
AWS CodePipeline V2 type pipelines introduces pipeline variable check rule
Favicon
AWS announces expanded service support in the #AWSConsoleMobile App
Favicon
AWS_WAF Bot Control Managed Rule expands bot detection capabilities to enhance web application security.
Favicon
Why Should E-Commerce Businesses Consider AWS Cloud Hosting?
Favicon
AWS Community Day Bengaluru 2024 โ€“ A Launchpad for Her to Reignite the Culinary Journey
Favicon
Natureโ€™s Splendor: Hiking the Mt. Rainier 7.5km Trail
Favicon
Reflecting on Mid-Year Milestones 2024: Our Impact on the Tech Community
Favicon
Empowering Future Cloud Leaders: My Mentorship Journey with Great Learning's Post Graduate Program in Cloud Computing
Favicon
AWS Cloud Practioner - Certification Preparation
Favicon
AWS Ambassador for the 2nd time
Favicon
Hosting a static Website on S3
Favicon
Understanding AWS Identity and Access Management (IAM)
Favicon
30 Days of AWS- Part 2: AWS Compute

Featured ones: