Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Boto3 update/overwrite object in S3 bucket

I can't find Python source code example to update/overwrite an object in an Amazon S3 Bucket.

Is this possible?

like image 728
user1187968 Avatar asked Apr 16 '26 07:04

user1187968


1 Answers

From the docs : https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.put_object

If you want to overwrite the object you just upload the file with the same name and if that name already exists it'll be done automatically.

Extra note: If you want to keep all historic versions of the object enable versioning on the bucket.

like image 61
JohnB Avatar answered Apr 17 '26 22:04

JohnB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!