Question

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

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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer