简体   繁体   English

Amazon S3的访问被拒绝错误

[英]Access Denied error with Amazon S3

I'm getting an Access Denied error with Amazon S3 and can't figure out why. 我在Amazon S3上遇到Access Denied错误,无法找出原因。

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. 我已经确认我的密钥是正确的。

The URL you show above would resolve to a bucket within S3. 您在上面显示的URL将解析为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. 为了使用这样的URL成功访问该存储桶,存储桶上的权限必须授予对存储桶的“公共读取”访问权限。 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. 另请注意,密钥(我假设您的AWS访问密钥和密钥)仅适用于通过API访问S3的情况。 If you simply access it with the URL via a browser, the credentials are not used in the request. 如果您只是通过浏览器使用URL访问它,则请求中不会使用凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM