S3 delete objects older certain modified date(boto3)

Subhasis Ray
1 min readMar 10, 2020

--

As we already know we can calculate total size of s3 buckets by iterating each object, in same way also we can delete old objects.

With below python and boto3 code we can iterate through each object and delete objects which are modified before some date.

Here we are doing from an organisation account user which switch account with “sts” with account ID.

https://github.com/Subhasis180689/python/blob/master/boto3/s3Bucket_deleteObj.py

--

--

Subhasis Ray
Subhasis Ray

No responses yet