Company
Date Published
Author
Giuseppe Cunsolo
Word count
492
Language
English
Hacker News points
None

Summary

Giuseppe shares his experience cleaning up a large number of objects in an Amazon S3 bucket using Python, specifically utilizing the boto3 library to connect to AWS and delete objects older than a specified number of days. He explains the use of paginators to handle more than 1000 objects in a bucket and details how he tested his code using the moto library to mock AWS services and freezegun to simulate different timestamps for objects. His approach involves creating a script that identifies and deletes old files in an S3 bucket by specifying a prefix path and threshold for age in days, ensuring that only outdated objects are removed while others are retained. Through this process, he demonstrates efficient S3 bucket management and testing strategies with Python.