1 Answer
- Newest
- Most votes
- Most comments
1
Hello.
Are the names of the objects obtained during backup the same?
If the names are the same, I think the easiest way is to enable versioning and create a lifecycle rule that deletes the old version after one month.
If the object name is different, I think you can create a Lambda function that tags the old object and set a lifecycle rule to delete the object with the target tag set.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html#lifecycle-config-ex1
Relevant content
- Accepted Answerasked a year ago
- Accepted Answerasked 3 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
Hi, Riku. The object names are different as they are creation date and time. For each customer, the backups are automatically created and uploaded to s3 every hour. Using the Lambda function, can I tag all objects except 3 latest objects/backups for each customer/prefix? These latest backups might be from a long time ago, e.g. 1 month ago, 3 years ago. Can I do that using a Lambda function? Thanks in advance.
I think it is possible if you just set tags on what is currently stored in S3. From now on, I think you can create a Lambda function that sets the tag on the previous object every time a new object is uploaded. I think it would be a good idea to record the latest object key in DynamoDB, etc., and then when a new object is uploaded to S3, set a tag on the object with the object key stored in DynamoDB.