boto3: Best way to delete object in S3


There are several ways to delete single object in s3 bucket using boto3 in Python.

S3.Client.delete_object(), S3.Bucket.delete_objects(), S3.Object.delete(), ...

I don't know how to choose the best way for our code.

Would you please give me information about what features each class has, what is the point in choosing an appropriate method?

Thank you.

asked 2 months ago121 views
1 Answer
Accepted Answer

You should use S3.Client from now on. The AWS Python SDK team does not intend to add new features to the resources interface in boto3. S3.Bucket and S3.Object implement the resources interface.

Would you check the first note in the following document.

answered 2 months 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.

Guidelines for Answering Questions