- Let's take a look at another demo
of adding a lifecycle rules to an existing S3 bucket.
Here we are in the console.
We are in the S3 service taking a look
at the AWS live lessons bucket that we've created earlier.
And here we want to add a lifecycle rule to that bucket
so that we can automatically transition objects
from S3 to Glacier after a period of time.
Now for these series of demos,
we're just gonna use this one bucket,
and we can use prefixes to do that.
So I'm gonna leverage the magic of the UI here
to create what appears to be a folder.
I'm gonna call this logs.
Now you'll see here there's nothing in there yet,
but perhaps later I might use an applications hosted
in Amazon EC2 to write their log files to S3
and then keep them for some period of time
before they are archived into Glacier.
So I'm gonna go over here, to go back to the bucket itself,
I'm gonna go to properties.
I'm going to scroll down here to the lifecycle section,
and I'm going to add a rule.
In this particular case, I don't want the entire bucket.
I only want a prefix,
so the prefix that I'm going to use is logs.
So that means everything under the logs quote unquote folder
will be archived to Glacier.
So I'm gonna click next,
and you can see I can use the lifecycle
to change the storage class
to either the infrequent access storage
or archive it to Glacier or permanently delete.
So one common use case is for some kind
of regulatory compliance, be it Sarbanes-Oxley or PCI
or, you know, whatever it may be,
we want to keep these for some period of time.
So I'm gonna archive to Glacier
let's say seven days, so I'm gonna keep them for a week
in case I wanna do some kind of computing with them,
batch processing, and then I want to permanently delete them
after about seven years, so 2600 days.
So you can see here that
if I were to upload something today,
then one week from now on November 10th,
it would archive to Glacier,
and then somewhere around seven years from now,
they would be deleted from Glacier.
So I'm gonna go ahead and hit review.
I'm gonna call this one archive logs,
and you can see here it says "This will apply
to objects with the prefix logs slash
in the AWS live lessons bucket."
It will archive to Glacier seven days
after the creation date and permanently delete
2600 days after the creation date.
So I'm gonna go ahead and create and activate that rule,
and there we go.
We can see that we have a lifecycle rule in place
for anything that goes into the logs folder,
and that is how we add a lifecycle rule
to an Amazon S3 bucket.