Amazon S3 policy allowing only upload not overwrite [duplicate]

拥有回忆 提交于 2021-01-26 03:46:24

问题


I'm developing a mobile application which will let anyone upload a file to an S3 bucket. I think I'll use the Anonymous Token Vending Machine that is provided by Amazon.

However, I can't see how to write a TokenVendingMachinePolicy.json file that will only allow uploading new files, not overwriting (effectively deleting). I thought allowing just s3:PutObject would be fine, but it appears the s3:PutObject permission allows both. This seems a bit strange, since there's a separate s3:DeleteObject permission, which is useless, since you can just overwrite with 0-length object anyway.

Is there any way to only allow uploading new files? How is this problem usually solved?


回答1:


Unfortunately it's not possible to have a write-once permission. A workaround would be to use versioning on your bucket.

See this answer to a similar question that explains it in detail:

Amazon S3 ACL for read-only and write-once access



来源:https://stackoverflow.com/questions/18157414/amazon-s3-policy-allowing-only-upload-not-overwrite

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