Is it possible to automatically delete objects older than 10 minutes in AWS S3?

前端 未结 3 1020
深忆病人
深忆病人 2021-02-04 13:34

We want to delete objects from S3, 10 minutes after they are created. Is it possible currently?

3条回答
  •  轮回少年
    2021-02-04 14:03

    In addition to the detailed solution proposed by @taterhead involving a SQS queue, one might also consider the following serverless solution using AWS Step Functions:

    • Create a State Machine in AWS Step Functions with a Wait state of 10 minutes followed by a Task state executing a Lambda function that will delete the object.
    • Configure CloudTrail and CloudWatch Events to start an execution of your state machine when an object is uploaded to S3.

    It has the advantage of (1) not having the 15 minutes limit and (2) avoiding the continuous queue polling cost generated by the Lambda function.

    Inspiration: Schedule emails without polling a database using Step Functions

提交回复
热议问题