Report this

What is the reason for this report?

AWS S3 SDK `client.put_object` does not overwrite the existing data in the bucket

Posted on June 17, 2020

I am using the below upload function to upload in a bucket but this does not overwrite the existing file in the bucket. If I upload an image with a particular format and update the image. The overwrite function does not work.

def upload(byte_stream, path, filename):
    bucket = doconn.get_bucket()
    object_key = os.path.join(path, filename)
    params = dict(
        Key=object_key,
        Body=byte_stream,
        ACL='public-read'
    )
    bucket.put_object(**params)
    return object_key

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.