Static Website Hosting using Amazon S3
Static Website Hosting using Amazon S3
What is S3:
S3 provides developers and IT teams with secure, durable, highly scalable object storage. It's easy to use with a simple web services interface to store and retrieve any amount of data anywhere on the web.
It's basically just a safe place to store your files.And it's referred to as object based storage.
Creating your first S3 Bucket:
So, let's create our first S3 bucket:
- First of all log in your AWS account and Go to AWS management console and search for S3.
- You will be directed to s3 management console. Here click on create bucket.
You will see the following pop up box.
· You need to give the name for your bucket. Bucket name should be the name of domain that you have.· Add tag. Most commonly used Tag is “ name “ and value could be any data for that tag.
· Then left remaining setting default and click on create bucket.
Your bucket has been created.
🎉
Now let's Upload our Static website on S3:
- Now we will upload our static website on S3. Just click on bucket name and click on upload.
- Select all your files and then drag and drop to console. Click on next, next and then upload. Your files will be uploaded.
- Now if you try to access your bucket through browser using URL of your main page ( index.html or any other). You would be unable to do that.we need to all public access to access bucket globally. Go to permissions and uncheck the box which says block all public access.
- Now let’s create a bucket policy to set overall permissions for our bucket. For that go to permissions, and use online policy generator.
- Set all properties , add statement and then click on generate policy. Copy that and paste it on place and click on save.
So, what's this policy says?
first we need to choose the type of policy. we are going to choose it as S3 bucket policy.
then we need to add the statement that includes:
Effects basically the result of action here we set whether we wanna allow or dany some actions.
Principle is basically permissions for all objects we use '*' here to show that we are doing this for all objects of bucket.
Then actions are basically the actions that we are going to perform with our bucket objects. you can whether all actions or as many according to your need.
Now add the ARN ( Amazon Resource Name) which you can see at the top where you are going to paste your policy.
the add statement , click on create policy , copy it and paste it in policy editor and click on save.
- We have almost all set now we need to make the bucket for static website hosting.For that under properties we need to set property. Set this bucket to host static website. Give the name of your landing page like index.html or index.js (that is for mine website your's may differ) and then click on save.
- Finally we have all done. now go to your bucket, click on main ( index.html or index.js ) page of your site, scroll down and you will see the URL that will allow you to access it through browser. just copy it and paste it in browser and hit enter.
Congrats and feel proud of yourself 😄. You have uploaded your Static website.😇😇
Hurrah! Congratulations we have done 🎊🎊…….!!!!!!!!
Hope you enjoy this.
if you are facing any issue then please let me know in comments.
and also let me know how much that proved helpful for you and how can i improve it.
Thanks!!!!😇😇
w
Awesome 🔥👍
ReplyDelete