3
votes

I am working on a POC where I have setup a Lifecycle rule on S3 to move objects to glacier after certain no of days (if objects have specified tag). Rule is working fine for me, objects are getting moved to glacier by lifecycle rule and storage type is change to Glacier from Standard. (so far so good).

As I need to restrict user to use that file (archived file) from my application, I am looking for a way to get notification (either through SQS) or invoke Lambda function (to call my application REST endpoint) when object is actually moved to glacier.

I have checked S3 supported event notification types here(http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#supported-notification-event-types) but it doesn't have any for storage change or object being moved to glacier.

Let me know if there is any way to configure this or any other approach I can use to achieve this behavior.

Regards.

1
If you use listObjectKeys or listBucket you can get the storage class of the object. Since an event isn't triggered, you'll have to check programmatically.Trent Bartlem

1 Answers

4
votes

You will not receive Lambda notifications for objects moved from S3 to Glacier via the Lifecycle rules.

When an S3 object is moved to Glacier, the object is not removed from S3. Instead, it's storage type is simply changed from Standard/RR/IA to "Glacier". And there is no notification type for storage type changes.

Also, the AWS documentation states:

You will not receive event notifications from automatic deletes from lifecycle policies or from failed operations.

Source: http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations