How to host a website on Amazon AWS S3?
Link to tutorial video: https://youtu.be/eYpV14z5F3Q
AWS S3 stands for Simple Storage Service. Customers of all sizes and industries can use it to store and protect any amount of data for different use cases such as websites, mobile applications, backup and restore, archive, enterprise applications, etc.
What is Amazon AWS S3?
AWS S3 is an object storage service that offers industry-leading data availability, scalability, security, and high performance.
According to Amazon Amazon S3 is designed for 99.99% of durability, and stores data for millions of applications for companies and customers all around the world.
What are the benefits of using AWS S3?
Some of the benefits of using AWS S3 are:
- Low cost
- Easily manage data and access control
- Simple data transfer
- High-level security by Amazon
- Industry-leading performance, scalability, availability, and durability
What is the AWS S3 bucket?
A bucket is a place in S3 where all of your data is stored. To upload your data, as - photos, videos, documents, etc, to Amazon S3, you must first create an S3 bucket in your AWS Regions. After that, you can upload your data in that bucket.
An Amazon S3 bucket name is globally unique for everyone. This means that after a bucket is created, the name of that bucket cannot be used by any other AWS account in any AWS Region until the bucket is deleted.
How to host a website on AWS S3?
Login to your AWS account
After that search for S3 in the AWS console Search box.
Open the S3 and You will see an interface like this.
Click on the "Create bucket"
Name your bucket. The bucket name is unique for everyone. After just click on "Create".
Once your bucket is created then just click on the bucket name and enter in that. After that click on upload and upload your website.
Once your files are uploaded then just click on the properties tab and under that section change the setting of "static website hosting" - " Use this bucket to host the website".
After that, you will be required to give the names of the home page and error page. i.e. - index.html and error.html
Note: If you do not have any error page then you can simply give homepage name in it.
Once done with properties then click on Permissions. Here you have to update the settings to allow the public access as we want everyone to see our website. So just turn off the Block all the public access tab.
After that in the same tab of Permissions just click on the bucket policy and put the following policy there.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::[YOUR_BUCKET_NAME]/*"
} ]
}
Note: '[YOUR_BUCKET_NAME]' with your actual bucket name
Save the bucket policy and come back to the Properties tab and in the static website hosting section you will have your website URL. You can visit the URL and your website will be live there.
Link to Video on How to host a website on AWS S3: https://youtu.be/eYpV14z5F3Q
Let me know in the comments if you have any other doubts :)
Happy Learning!
Data Analyst at Statfinity | From Data to Decisions | Python | SQL | Looker Studio | GCP | GA4 | Power BI.
4 年This is helpful for everyone..?
Spatial Data Scientist || EE Developer Community Program Lead
4 年This is nice