- Newest
- Most votes
- Most comments
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.
There are a few potential reasons why your S3 Lifecycle rule might not be expiring or deleting files older than 4 days as expected:
-
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.
-
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."
-
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.
-
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.
-
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.
-
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.
-
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
Relevant content
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago

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