How To Setup AWS S3 – Detailed Beginner’s Guide
AWS is a major player in the cloud service provider space. In this article, we are going to have a detailed look at AWS S3 – one of Amazon’s oldest & most used cloud service.
AWS S3 is one of the most popular services from Amazon and it is used very widely – whether it is to store large amount of data or to host a static website. This article explains creation, configuration and management of the AWS S3, which will be ideal for a beginner.
What is AWS S3?
S3 stands for Simple Storage Service and is Amazon’s storage platform. It is an object based storage system and you can upload any type of files – big or small. It cannot be used as a drive for an operating system or a database for example. You can store files as large as 5TB in S3. It offers unlimited storage – whether it is the total volume of data or the number of objects you can store.
How do we work with S3? It is pretty straightforward. Login to your AWS management console and search for S3 in the top search bar.
Yes! The AWS management console has the dark mode in Beta. If you want to change to dark mode, click on ‘Settings’ under your account name, in the top right hand corner.
You will get the option to edit the display settings. Click the edit button on the right hand side and select the dark mode.
What is an S3 Bucket?
The S3 bucket is a container for objects stored. Think of it as a Windows folder on your machine. You can store any number of objects in a bucket and can have up to 100 buckets per account by default. The easiest way to interact with the S3 bucket is using the browser.
The S3 has a universal namespace – not within your tenant, but the whole of AWS. Think of it as your tenant name if you are an Azure professional, the name is unique across the world. Similarly, you need to input a unique name for your bucket during creation.
The S3 bucket has https://bucket-name.s3.region.amazonaws.com as the namespace. If your region is us-east-1 and the bucket name is cloudiffic, your bucket url will be https://cloudiffic.s3.us-east-1.amazonaws.com
How To Create An S3 Bucket
Creating an S3 bucket is a straight forward process. Login to the AWS management console, search for S3 (you can also add S3 to your favourites). You will be given a list of all the buckets you currently have and an option to create one.
Click on ‘Create Bucket’ button to start the process.
Enter a unique name for the bucket. If the name is already in use, AWS will prompt you to enter a new name. Select the region where your bucket will be hosted. I will stick to us-east-1. You can copy settings from an existing bucket if you have one. We will go with the default options now and I will explain the various options later in the article.
Click on ‘create bucket’ button at the end of the page.
The bucket will get created in a few seconds.
Once the bucket has been created, you can upload your files into it using the ‘upload’ button. The data in S3 is stored safely across multiple datacentres.
Server Side Encryption In S3
There are a number of ways to secure the data in S3. First one is server-side encryption – the admin can set default encryption on a bucket to encrypt all new objects stored in the bucket. To enable server-side encryption, select the ‘properties’ tab of your S3 bucket.
Click the ‘edit’ button against the Default Encryption option.
Select ‘enabled’ and save the changes. Easiest option is to stick with AWS managed keys.
Access Control Lists (ACLs) In S3
ACLs helps an admin to define which AWS accounts or groups are granted access & the level of access. You can attach S3 ACLs to individual objects within a bucket. Think of it like the file level permissions in the Windows world.
You can use the edit button and add / modify permissions on the file level.
Versioning can be enabled on the bucket level, so that S3 keeps all the previous versions of your objects. Click on the ‘properties’ tab of your bucket.
Navigate to the ‘Bucket Versioning’ section, click the edit button and enable versioning.
Hosting Static Website On S3
S3 can be used to host static websites, the ones that have .html files. They cannot be used if the website is dynamic, for example that requires database connections. Organizations do make use of S3 for hosting static websites especially if there is going to be a large number of requests.
The benefit of S3 is that it will scale automatically depending upon the demand. In order to setup your bucket to host a static site, the option needs to be enabled. You will also need atleast an html file (your homepage) to make it work.
Head over to the ‘properties’ tab of the bucket.
Scroll all the way down & click on the ‘edit’ button against the last option ‘Static Website Hosting’.
Click ‘enable’ and fill in your homepage (index.html) and error page file names. Make sure to upload these files to the bucket and make them public before the website displays it to the outside world.
Once the static hosting is enabled, S3 will provide a public url to access the website.
We have only gone through the basic options with AWS S3, but this will definitely be a good starting point on which we can build on. Let me know if you have any questions in the comments section.