- 최신
- 최다 투표
- 가장 많은 댓글
Hi,
I think there are multiple ways to achieve this. But, for your scenario, you can try to do something like this:
- Create a Lifecycle rule for expiration with Object tags as "archived: true", and expiration days after 1 day.
- This should trigger the daily deletion of all the objects within the bucket with the specific tag.
I have not tested this functionality personally but it seems achievable. You can try to test it and perform a HeadObject API call on these objects to see if S3 has evaluated the object and determined if it's eligible for expiration. [1]
Alternatively, you can use a Lambda function triggered by an S3 event notification on tag addition, or scheduled notification. The function can check for the required tag and use the S3 SDK to delete the object.
Or, you can use AWS Batch to run one-off delete jobs on tagged objects. The job script can use AWS CLI commands like aws s3api delete-object to remove objects.
Hope this helps.
References:
[1] https://repost.aws/questions/QUouAaZs08T7GYuDu3OIGLsA/s3-lifecycle-rules-with-tag-filters
[2] https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-expire-general-considerations.html