Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 Object Expiration Less Than 24 Hours

The built in Object Expiration is 1 day (plus the time to next midnight UTC). Is there a mechanism to do this at a more frequent basis? Given it appears that AWS does this across the board at midnight UTC then it's likely there would need to be another mechanism to delete objects sooner. We're looking for something in the 6-8 hour time frame. What other options if any would there be?

Thank you

like image 282
Travis Howe Avatar asked Aug 09 '16 12:08

Travis Howe


People also ask

Do S3 objects expire?

S3's new Object Expiration function allows you to define rules to schedule the removal of your objects after a pre-defined time period. The rules are specified in the Lifecycle Configuration policy that you apply to a bucket. You can update this policy through the S3 API or from the AWS Management Console.

Why is my Presigned URL for an Amazon S3 bucket expiring before the expiration time that I specified?

If you created a presigned URL using a temporary token, then the URL expires when the token expires. The URL expires even if the URL was created with a later expiration time.

Can the user disable the life cycle rule of the S3 bucket?

You can temporarily disable a S3 Lifecycle rule. The following S3 Lifecycle configuration specifies two rules: Rule 1 directs Amazon S3 to transition objects with the logs/ prefix to the S3 Glacier Flexible Retrieval storage class soon after creation.

What is life cycle rule in S3?

An S3 Lifecycle configuration is an XML file that consists of a set of rules with predefined actions that you want Amazon S3 to perform on objects during their lifetime. You can also configure the lifecycle by using the Amazon S3 console, REST API, AWS SDKs, and the AWS Command Line Interface (AWS CLI).


1 Answers

If 12 hours is an acceptable upper bound, then you can setup an S3 event notification to post a message to an SNS topic that has an SQS queue subscribed to the topic with a visibility timeout of the 6-8 hours you're looking for.

diagram

like image 168
jaredready Avatar answered Nov 15 '22 15:11

jaredready