With AWS S3 you can host a website in some simple steps, that require no more than 5-10 minutes and this small tutorial is perfect for a quick coffee break.
If you just need a small website with text and some images, s3 might be the solution you are looking for. If you’re learning AWS this will help you understand S3 and how to make objects publicly available.
This is what our sample website will look like:
Step by Step Guide: Host a Website on S3
Create a Bucket
- Click on Services and choose S3, Create new Bucket
- Choose a unique bucket name, as a tip choose one you can easily identify your project with eg. “Websiteons3″
- In the Region tab select a region close to you.
While the s3 buckets are globally available, you will have to pick a region where it will be hosted. You should prefer a bucket close to you or the audience to make the latency as low as possible.
- Click next and skip the Set properties tab
- Under Set permissions in the field Manage public permissions, select “Grand public read”.
Make sure you understand the implication of this, because when you set a bucket to public read access, everyone with the URL of this bucket will have access to the containing files. In our case, we use this option to publish a website, but check that you don’t reuse this bucket for private purposes.
Upload the HTML file to S3
- Click next and under the Review tab click on Create bucket. In the Console, select the S3 bucket you just created.
- Now we will upload the file that contains a simple website with some text. Right-click on this link and select “Save target as” to download the index.html file: https://s3.eu-central-1.amazonaws.com/tutorialfileselasticcloudblog/s3bucket+tut/index.html
- Inside the bucket, select Upload and upload the file: index.html. Select or drop and drag the file into the dialogue window and click on next
- Under Set permissions in the field Manage public permissions, select “Grand public read”
- Skip the next dialogues and click on upload
- Enable the s3 Bucket to host a Website
- Back in the console, click on Properties and then select Static website hosting
- Select Use this bucket to host a website and enter the name “index.html”. This is the file we just uploaded to your bucket. This is the website AWS is going to display. Copy or click the link on top labeled Endpoint.
- This will bring you to your new Website which should look like this:
Thank you for following this tutorial.