Hosting an website in AWS S3 Bucket in 5 mins
In my previous post i have explained how to host a website in Firebase. But in firebase we will face a CORS issue if the any URL is of type http. So it will be a problem in firebase and we can’t push the data also
But there is a solution for it we can use Amazon S3 Bucket to host our site no matter whether it is http or https it will be taken care by Amazon S3 Bucket.
What is Amazon S3 Bucket:
Amazon Simple Storage Service is storage for the Internet. It is designed to make web-scale computing easier for developers.
Amazon S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits on to developers.
Hosting a website in Amazon S3:
We will see how to host an website in S3
Step 1: Login to aws console
Step 2: Enter your login credentials if not create a new one
Step 3: Select S3
Step 4: Click Create New Bucket
Step 5: Enter the bucket name as well as select the region
Step 6: Once the bucket name is completed upload the website data’s
Step 7 : Once the files are uploaded select the Properties tab and click Static Webhosting
Step 8: Enable Use this bucket to host a website
Step 9: Once the static web hosting is clicked .Enter the index document (index.html) as well as the error document(404.html)
Step 10: Click save and move to permission tab
Step 11: Click the Bucket policy button and add the following code to allow the website which can be accessed by anyone
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "Replace the arn number" //Replace the arn number of your bucket
}
]
}
Step 12: Once the Bucket policy is created your site is ready goto properties and select the static web hosting and copy the endpoint.
Note:
Amazon S3 Bucket cannot extract data from Zip files so we have to copy the folder and paste
Amazon S3 Bucket cannot extract data from Zip files so we have to copy the folder and paste
Comments
Post a Comment