Skip to content

S3 Bucket - LifeCycleRule Not Expiring Based On Rules

0

I have an S3 bucket where I save database backups to twice a day. I do the backup on my Linux machine and then upload the backup file to the S3 bucket. On the S3 bucket, I created a LifeCycle rule to delete any backups older than 4 days.

The problem is that it does not expire/delete files older than 4 days. For example, I still have files from December 24 in the bucket. I have a similar rule set up for another bucket, and that rule is also not working.

I don't use Bucket versioning; all the files are in the 1 folder. I've attached a screenshot of the rule and the older file dates.

I did look at multiple video's and other questions, but didn't help. Been busy trying to figure this out for more than a month (just been deleting manually)

LCR-Setup bucket_file_sample

asked 2 years ago787 views

2 Answers
2

Hello.

As you can see in the image, the lifecycle rule targets objects under the folder "mask-onprem-backups/", but the objects are located in the folder under "database_level_backups/".
In this case, objects under "database_level_backups/" will not be deleted, so please correct the prefix of the lifecycle rule.
I think the problem can be solved by changing the prefix of the lifecycle rule to "database_level_backups/".
Do not enter the bucket name in the lifecycle rule prefix.
This is written as a note when setting the prefix.
a

EXPERT

answered 2 years ago

AWS
EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

  • Silly me!! I have made the change, let's see if it works tomorrow. THANK YOU.

1

There are a few potential reasons why your S3 Lifecycle rule might not be expiring or deleting files older than 4 days as expected:

  1. Rule configuration: Ensure that the Lifecycle rule is correctly configured. Based on the screenshot provided, it appears that you have set up a rule to expire current versions of objects after 4 days. This is correct for non-versioned buckets.

  2. Rule status: Verify that the Lifecycle rule is enabled. In the AWS S3 console, under the Management tab of your bucket, check if the rule status is set to "Enabled."

  3. Object eligibility: Make sure that the objects in your bucket match the rule's filter criteria. If you've specified a prefix or tags in the rule, ensure your objects meet these conditions.

  4. Timing and processing: S3 Lifecycle rules are not instantaneous. Amazon S3 typically completes the lifecycle action within 24 hours of the object reaching its eligibility date. There might be a slight delay in processing.

  5. Permissions: Ensure that the S3 service has the necessary permissions to perform the delete operation. Check your bucket policies and IAM roles to confirm that there are no restrictions preventing S3 from deleting objects.

  6. CloudTrail logs: You can check AWS CloudTrail logs for any "AccessDenied" errors related to S3 Lifecycle operations. This can help identify if there are any permission issues.

  7. Monitoring: Consider setting up CloudWatch metrics or alarms to monitor the S3 Lifecycle operations and ensure they are functioning as expected.

If you've verified all these points and the issue persists, it may be worth contacting AWS Support for further assistance. They can provide more detailed insights into your specific bucket configuration and help troubleshoot any underlying issues.

In the meantime, you can continue to delete files manually or consider using S3 Batch Operations for bulk deletions if needed.
Sources
Troubleshooting S3 Lifecycle issues for directory buckets - Amazon Simple Storage Service
s3-lifecycle-policy-check - AWS Config

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.