Access Denied error with Amazon S3

↘锁芯ラ 提交于 2020-01-03 11:46:34

问题


I'm getting an Access Denied error with Amazon S3 and can't figure out why.

My settings are as follows:

STATIC_URL = 'http://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME

What would cause an access denied error? I have verified that my keys are correct.


回答1:


The URL you show above would resolve to a bucket within S3. In order to access that bucket successfully with such a URL, the permissions on the bucket would have to grant 'public-read' access to the bucket. In addition, each object or file within the bucket would have to grant 'public-read' access, as well.

Do you want the bucket and all content within the bucket to be readable by anyone? If so, make sure the permissions are set appropriately. Note, however, that granting 'public-read' to the bucket itself will allow anyone to list the contents of the bucket. That's usually unnecessary and probably should be avoided.

Also note that the keys (I assume you mean your AWS access key and secret key) only apply when you are accessing S3 via the API. If you simply access it with the URL via a browser, the credentials are not used in the request.



来源:https://stackoverflow.com/questions/13167493/access-denied-error-with-amazon-s3

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