One of the biggest requirement in IT sector is to manage the storage. Amazon S3 is nothing but the Simple Storage Service in AWS Cloud. In this topic, we will talk about how Amazon S3 changes everything. Amazon S3 providing practically unlimited and cost-effective storage which is available on-demand.
Not only this, but Amazon S3 also provides the hosting of static websites with high availability and very low-latency. So let’s talk about what is Amazon Simple Storage Service and how to use it?
Table of Contents
- 1 What is Amazon S3?
- 2 Why Amazon S3?
- 3 Use Cases of Amazon S3
- 4 Amazon S3 Bucket
- 5 Amazon S3 Object
- 6 Setup Amazon S3
What is Amazon S3?
Amazon S3 is an abbreviation for the Amazon Storage Service in AWS cloud. AWS S3 provides IT teams, Developers a highly secure, durable storage with low latency on AWS cloud. It is basically an object storage service of AWS which can store and retrieve unlimited data from anywhere in the world.
AWS S3 stores object within the S3 buckets. An object is consist of a file and the metadata (optional) of the file. For better understanding. you can think like it’s just the file storage in the AWS cloud. And that can keep additional information about your files.
Why Amazon S3?
The first question comes in mind that there are several free storage spaces and services are available then why Amazon S3? Let me give plenty of reasons to support why the Amazon S3 is used by millions of cloud user across the world.
Amazon S3 is intentionally built with the focus on simplicity and robustness with the very minimal feature set. In addition to that never forget the power of cloud computing and its scaling nature.
Let’s discuss a few of the many features that Amazon S3 offers.
Like any other service, AWS S3 is also designed to be available at least 99.99%. You can also choose the AWS region and where to store your data. You can address the latency and optimized the cost by choosing the most suitable region where your services are used most.
This is perhaps the best thing with AWS S3. You can configure and enable the notification to send when objects are loaded into S3 buckets. AWS offers a variety of notifications like:
- Lambda Trigger
This way you can also set up the workflows for your object and files in Amazon S3. For example, When you upload an image to S3 a lambda function triggers which creates multiple sizes of uploaded image. And send an email to admin with the path of all images.
Amazon S3 is extremely durable and it provides 11 9s durability. That means if you upload a 1000 objects then data loss of 1 object may occur once in a 10,000,000 (a million) years.
AWS S3 stores the objects multiple availability zones.
Highly Cost Efficient
It’s also very cost efficient. You can store a huge amount of data at a very low cost. You will only pay for what you use. Also, there are a variety of storage classes are available. You can choose the best storage class for your data.
S3 is also available in AWS free tier:
You can read our post on “Amazon Web Service (AWS)” to more about the cost model and free tier.
Unlike any other storage, Amazon S3 is also highly scalable. You can scale up or down as required.
Integration with Other Services
Amazon S3 can be fully integrated with many services available on AWS. I can list some of them for you so that you can go and explore on AWS:
Use Cases of Amazon S3
Let’s take a look at some of the popular use cases of Amazon S3.
Backup & Archive
Amazon S3 is ideal for backup and archiving. It can store a practically unlimited amount of data which is the basic requirement for backup and data archive.
Traditional IT infrastructure offers finite data storage capability. You have to manage the data backups and archives you will retain and what not. This is not a problem at all with the Amazon S3.
AWS S3 is not just designed to store the files, it can store really big objects. It can store photos, videos and financial data etc.
Using AWS service you can perform the big data analytics on the data stored in Amazon S3.
It’s a very common use case of Amazon S3. You can store any kind of media hosting on S3 which includes video, photo, or music uploads and downloads.
Another key use case of Amazon S3 is disaster recovery. For those who don’t know “Disaster recovery is the process of bringing back your site, data, application or infrastructure from any kind of server crash or data loss.”
As I mentioned in the starting that all the data in Amazon S3 is stored and replicated in different availability zones. You also have an option to replicate it in other regions using cross-region replication. For point-in-time recovery, you can also store the multiple copies of the data.
Content Storage & Distribution
Amazon S3 is best for content storage and its distribution. You can upload your entire infrastructure into the cloud to minimize your cost drastically.
You can make your content available directly to the end users. Amazon S3 is one of the sources to the Amazon CloudFront to provide data on edge locations. When we will talk about Amazon CloudFront then will see what value it adds on top of S3.
Host Static Website
One of everyone’s favorite use case is to host a static website. Amazon S3 allows you to host an entire static website and on very low cost too.
Hosting a static website on Amazon S3 is a highly available and scalable hosting solution. I will post a separate topic on this.
Amazon S3 Bucket
AWS stores your data in S3 buckets. Amazon S3 is a globally unique name used by all AWS accounts. This means that once the bucket has been created then the name cannot be used by any other AWS account in any region.
AWS creates the bucket in the region you specify. You can choose the closest regions to you and your customer.
Ideally, you should not depend upon any specific naming convention or pattern to create an Amazon S3 bucket.
Name rules and limitations
By default, you can create 100 buckets in an AWS account. You can increase this by submitting a service limit increase. There are several rules and limitations that you need to take care of:
- You cannot change the name of the bucket once created – Choose the name wisely.
- Bucket name must be unique across all account and regions .
- SInce you can host static website so bucket name must comply with all DNS naming conventions.
- Bucket name must have at least 3 and maximum 63 characters.
- Bucket name must start with lowercase letter or number.
- Bucket names must not be formatted as an IP address (for example, 127.0.0.1).
- After March, 2018, Amazon do not support the uppercase letters and underscore in bucket names.
If AWS does any change in the naming convention it communicates to its account holders well in advance.
Amazon S3 Object
Amazon S3 stores the key and value pair as an object in buckets. An object in Amazon S3 typically consists of:
- Key – to uniquely identify an object in bucket
- Version ID – Amazon S3 generates version id when you upload and object.
- Value – The content that you are storing.
- Metadata – Information about the object in key value pair.
- ACL – Access Control information of an object in Amazon S3 bucket.
Amazon S3 provides 6 storage classes for different use cases. See below is a really comprehensive comparison of all the Amazon S3 storage classes.
Setup Amazon S3
Let’s get started with Amazon S3. In this exercise, we will create an S3 bucket and will store some objects into it.
Get Started with S3
To get started with Amazon S3, you must have an AWS account created and activated. If you are new then to AWS then please read my post on “Amazon Web Services (AWS)” to get started with AWS cloud.
- Go to the https://aws.amazon.com/s3/ and choose to get started with Amazon S3 OR Go to services and search for S3.
- Follow the onscreen instructions
Create a S3 Bucket
After click on the Amazon S3 link, you will see the below screen.
Click on the button “Create Bucket”.
Enter the bucket name and remember that this bucket name must be unique. See the rules and restrictions I described in the section above.
Click on the “Next” button and set config options & permission for your bucket:
It’s highly recommended not to allow the public access to your S3 bucket.
Review the settings and the configurations you did. I’m creating an S3 bucket with the name “journaldev” in the closest region to me.
AWS will take a few seconds to create your S3 bucket. Once done, you will see that your bucket in the list. You can select the checkbox to see the properties. Also, you can change the ACL at any point in time.
Add an Object to S3 Bucket
Click on the name of your bucket to start uploading objects in your bucket. You can also create a folder in the S3 bucket. Let’s click on the “Upload” button.
Choose and upload a file. You can upload as many files as you want in one go. Please notice that Amazon S3 is not just uploading a file, it’s keeping other information like metadata, ACL, and properties etc. That is why we call it an object.
Click on the “Upload” button and your object has been uploaded.
You can see the object has been uploaded to the S3 bucket you created.
Click on the link to see the details of the object. You can make this object public by changing the ACL (Access Control Permissions).
Change Storage Class
Amazon S3 stores the objects in default storage i.e. Standard. There is an option to change the storage class if you want. I’m doing this just to show you the storage classes that we were talking about.
You can choose the other storage classes and save the object.
Let’s delete the object from Amazon S3 bucket. Choose the option available from actions and delete the objects into a two-step process.
Step 1: Choose the object to delete
Step 2: Confirm the object deletion
Choose the bucket that you want to delete. As AWS mentioned in the note that you must think twice before deleting a bucket. The reason is bucket names are global and anybody else can pick that name after your deletion.
Stay tuned with us, we will post on How to host a static website on Amazon S3 with a very low hosting cost, with high availability and low-latency.