Python Boto3 S3 Bucket Encryption result in 0 bytes file

北城以北 提交于 2019-12-24 20:52:12

问题


Needing some help here.

I have a Python script using Boto3 that does S3 Bucket encryption. It was working fine before this and just recently I noticed that when I use the script, it will cause the object to become 0 bytes. It is working just fine if I were to encrypt it manually via the console.

Is anyone facing similar issue and would you mind to share any workaround? At least to recover back the files. I am clueless here.

I've did a quick troubleshooting and found out that when below line is executed, it will change the files to become 0 bytes.

client.put_object(Bucket=bucket_name, Key=object_key, ServerSideEncryption='AES256')

Thank you very much for your help and assistance.

Regards, Ameer.


回答1:


That line of code is missing a Body parameter. You aren't telling it what file or contents to upload.



来源:https://stackoverflow.com/questions/50396332/python-boto3-s3-bucket-encryption-result-in-0-bytes-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!