In this lesson you will learn how Amazon S3 stores data, what the difference is between durability and availability, how to choose the storage class based on how often the data is read and how long you can wait, and how to automate class changes with a lifecycle policy.
Amazon S3 (Simple Storage Service) is the AWS object storage service, that is, a place where you upload complete files and later request them by their name. That is where the files an application uploads usually end up. For example, an online store keeps the photos of its products in S3, and the store's website requests them from S3 every time a customer views them.
In S3, the same file can be read right away or take up to 48 hours to become available again, depending on the storage class you store it in, and each class costs a different amount. That is why the exam asks you to choose the right class for each case. For example, the photos the store shows all day long can't be slow to read, while its invoices from five years ago can wait in exchange for costing less.
How does Amazon S3 store data?
With S3 you store files in amounts with no practical limit, without setting up disks or calculating how much space you will need. To do it, you create a bucket in a Region, which is like a container with its own name, and upload objects to that bucket. Each object is a file together with its metadata, can be up to 50 TB in size and is identified by a key, which is its name inside the bucket. For example, the store creates a bucket called store-photos and uploads the photo of a shoe with the key red-shoe.jpg.
A key can contain slashes, such as "products/red-shoe.jpg". The console shows "products/" as if it were a folder, but that part is only the beginning of the object's name. For example, if the store deletes all the objects whose key starts with "products/", that folder stops appearing, because it never existed separately.
Names, access and versions
An S3 bucket has three characteristics that affect how you name it and who can read its objects:
The names of general purpose buckets, which have to be unique across all AWS accounts in the partition and not only in yours, so you can't name your bucket "photos". For example, if someone else in the world already has a bucket called store-photos, the store has to choose another name, such as store-photos-lima.
Access to a new bucket, which starts out private because the bucket comes with Block Public Access turned on, so for someone to read an object you have to give them permission. For example, if the store wants any visitor to see the photos of its products, it has to grant that permission on purpose.
Versioning, which keeps every version of an object, so if someone deletes or overwrites it by mistake you can recover the previous version. For example, if a store employee uploads a blurry photo by mistake with the same name as the good one, the good photo is still kept as the previous version.
True or false?
0 of 4
You can name your bucket "photos" if nobody in your account uses that name.
A new bucket comes with Block Public Access turned on.
In the key "products/red-shoe.jpg", products/ is part of the object's name.
With versioning you recover an object that someone overwrote by mistake.
What is the difference between durability and availability?
Durability measures how likely it is that an object is kept without being lost. All current S3 classes have a durability of 99.999999999% (eleven nines), which means they are designed to almost never lose an object. For example, the store can count on the photo of its shoe still being stored many years from now.
Availability, on the other hand, measures how much of the time you can read the object, and that one does change depending on the class. For example, availability is 99.99% in S3 Standard, 99.9% in S3 Standard-IA and 99.5% in S3 One Zone-IA. An object can be safely stored and, for a while, not be readable: the shoe photo isn't lost, but a customer might have to wait to see it while the service isn't responding.
What storage classes does S3 have?
Every S3 object has a storage class, and each class charges differently for storing and for reading the data. The less often data is read, the cheaper it is to store and the more it costs to read. For example, it pays for the store to spend more on storing the photos that are viewed all day, because it reads them many times, and to spend little on storing old invoices it almost never opens.
The main classes differ in how often the data they store is read, from the most read to the least read:
S3 Standard, which is for data that is read more than once a month, such as the photos of the store's products.
S3 Standard-IA, which is for data that is read once a month and whose name comes from infrequent access, such as the sales report the store reviews every month.
S3 Glacier Instant Retrieval, which is for data that is read once a quarter and needs immediate access, such as contracts with suppliers that are reviewed now and then.
S3 Glacier Flexible Retrieval, which is for data that is read once a year, such as the annual accounting close.
S3 Glacier Deep Archive, which is for data that is read less than once a year, such as the invoices the store keeps in case someone asks for them one day.
The classes for data that is rarely read charge a minimum storage duration for each object, which is 30, 90 or 180 days depending on the class. If you delete the object earlier, you still pay for that full period. For example, if the store stores a file in a class with a 90-day minimum and deletes it after a week, it still pays for the 90 days.
Choose the class based on how often the data is read
Choose how often the data is read and how long you can wait to read it. The class that fits is highlighted.
The arrow goes from the class read most to the one read least: going down, storing costs less and reading costs more.
Use S3 Standard.
It is read often. The other classes cost less to store, but more for each read, and here there are many reads.
Single-zone classes
Some classes store data in a single Availability Zone, instead of spreading copies across several. S3 One Zone-IA is cheaper than Standard-IA, but if that zone is lost you lose the data too, so use it only with data you can re-create. For example, the store keeps in One Zone-IA the small photos it generates from the originals, because if they are lost it generates them again.
S3 Express One Zone also uses a single zone and is the class with the lowest latency, that is, the one that responds the fastest. For example, a program that reads thousands of files in a row to do a calculation finishes sooner if it has them in that class.
S3 Intelligent-Tiering
When you don't know how often a piece of data will be read, S3 Intelligent-Tiering changes its tier for you. An object that goes 30 days in a row without being read moves down to the infrequent access tier, and after 90 days it moves down to Archive Instant Access. If someone reads it, the object goes back to the frequent tier. For example, the store opens a new section and doesn't know whether its photos will be viewed much: the photos nobody visits move down to a cheaper tier on their own.
In exchange for that automatic movement, Intelligent-Tiering charges a fee for monitoring each object. Also, objects smaller than 128 KB are not moved between tiers. For example, a text file with a single line always stays in the frequent tier, even if nobody reads it.
Which class do you choose?
0 of 5
Tap the correct column for each type of data.
Profile photos that are read many times a day
Backups that are read once a month and are needed instantly when requested
Thumbnails you can re-create from the original photo
The data of a new app, for which you don't know how often it will be read
Reports that someone looks at once a month
How is archived data retrieved?
Objects stored in Glacier Flexible Retrieval or in Glacier Deep Archive can't be read right away, because first you have to request that they be restored, that is, that S3 makes them ready to be read again, and wait. Each class offers restore options with different times:
Option
Glacier Flexible Retrieval
Glacier Deep Archive
Expedited
1 to 5 minutes
Not available
Standard
3 to 5 hours
Up to 12 hours
Bulk
5 to 12 hours
Up to 48 hours
For example, if an auditor asks the store for an old invoice stored in Deep Archive, the store requests the restore and the invoice can take up to 12 hours to be ready with the Standard option.
Which class do you choose?
A company stores records that are looked at less than once a year. When someone requests one, they can wait up to two days. The company wants the lowest cost. Which class do you choose?
Lifecycle policies
A lifecycle policy is a rule that changes the class of the objects in a bucket or deletes them without you having to do it by hand, and it applies both to new objects and to the ones that were already in the bucket. It is used so data moves to a cheaper class on its own as it is read less. To do that it uses two types of action:
Transition, which changes the object's class after a certain time.
Expiration, which deletes the object after a certain time.
For example, a policy can move invoices to Standard-IA after 30 days and to Glacier Flexible Retrieval after a year, and make them expire after seven years. The 30 days and the year come from the example in the S3 guide, while the seven years are the period set by the company that stores the invoices.
How do you recognize each class on the exam?
In questions about S3, look in the question for how often the data is read and how long people can wait for it. These are the phrases that point to each option:
"Unknown access pattern" or "changing access pattern", which points to Intelligent-Tiering.
"Infrequent but immediate access", which points to Standard-IA or Glacier Instant Retrieval.
"Long-term archive" with hours or days of waiting, which points to Glacier Flexible Retrieval or Deep Archive.
"Data that can be re-created" at the lowest cost, which points to One Zone-IA.
"Move or delete objects automatically", which points to a lifecycle policy.
For example, if a question says that a school stores assignments that almost nobody opens but that must be ready right away when a teacher asks for them, the phrase points to infrequent but immediate access.
cloud path tip: if the question says they can wait up to 48 hours for the archived data, the cheapest class is Deep Archive.
cloud path tip: if you use an account with the new AWS experience, S3 is included in the free plan, but that plan doesn't let you upload objects with the Glacier Flexible Retrieval or Deep Archive classes, and Deep Archive is only available with the paid plan.
Review question
A company stores recordings from its security cameras. The ones from the last month are reviewed often, and after that almost nobody opens them, but when a judge requests one it has to be available right away. Which configuration costs the least and requires the least work?
Next
Storage, the AWS whitepapers page that summarizes its storage services.