- Now let's talk about storage class management
with lifecycle rules.
When we're storing data in S3,
we need to keep in mind that there are several different
storage classes to choose from
and those storage classes will affect
what we end up paying for that storage, over time.
The default storage class
is called the Standard storage class
and this will store upwards of six copies of our data
redundantly across numerous availability zones.
So we get the very high degree of durability in that data.
And it's stored redundantly but it's stored in a way
that enables a very fast access
so that when we do want to read that data,
it's available to us to get very quickly.
We can lower our costs
by looking at the other storage classes.
Now another storage class
would be the Standard-Infrequent Access.
Now with Standard-Infrequent Access,
we can lower our costs for data that we just don't look at
quite as often.
Now, the thing about Infrequent Access
is that we still get the same amount of durability
but it's just stored in a different way.
And it's written to storage
that is optimized for infrequent access.
So, there may be data that we don't read very often
but when we do read it,
we want to be able to get it synchronously at will.
Another storage class
would be the One Zone-Infrequent Access.
And in this regard,
we get a lower degree of durability.
Remember that with Standard and Standard-Infrequent Access,
the data is stored across numerous availability zones.
With One Zone-Infrequent Access, as the name suggests,
the data is being stored in one zone.
And so we get less resiliency
but we also get a much lower cost.
And then lastly, as we've already talked about,
we have Glacier.
And when data is transitioned to the Glacier storage class,
the data is moved into the Glacier service.
But keep in mind
that if you write data to S3
and then you transition that data to Glacier,
you have to go to S3 to get it out.
You can't get the data directly from Glacier.
You have to go to S3 and manage that data from within S3
because that's where the data essentially originated from.
Right so, keep these storage classes in mind
that as you move forward using S3,
we can lower our bill by optimizing the storage class
for the particular types of data.
Now another thing that we can take advantage of,
or as what we call Lifecycle Rules.
And so within S3,
remember that within S3,
we're writing objects into buckets.
And so, we might have certain types of data
and we might say for a particular type of data
after seven days,
then let's automatically transition that
to Standard-Infrequent Access
So it could be maybe a log file, for example.
A log file gets wrapped up and rotated
and that log file gets shipped to S3.
And perhaps some time during that first seven days,
you may do a lot of analysis on that log file.
And then after seven days,
you may continue to do some analysis
but maybe not as often or not as much.
And so you want to lower your cost
by transitioning it to Standard or Infrequent Access,
but still have it available
for when you do actually need it.
And so we may put another lifecycle rule in place
and say after 30 days,
transition to Glacier.
And so some time in that first month,
you may perform different types of analysis
and pull that data in
and do some type of processing on it.
But then after those 30 days,
you still need to keep it due to perhaps regulatory needs.
But you're probably not going to do anything with it.
And so by transitioning to Glacier,
what this particular object then essentially becomes
an archive in a vault within Glacier, automatically.
Just by putting these lifecycle rules in place,
the S3 and Glacier systems work together
to move that data around in order to satisfy these rules.
And so the really great thing about that
is that we don't have to write scripts
and worry about the management on our own.
All we have to do is put the rules in place
and rely on AWS to transition that data for us.
And then of course, we could also say
we could do one more thing here
and say perhaps after 2600 days or about seven years,
permanently delete that data.
And so once we put these lifecycle rules in place,
as time goes on,
as objects are written and transitioned and deleted,
we can rest assured knowing that we've optimized
our usage of these different storage classes
in order to optimize our costs
for storing large amounts of data within AWS.