Pra*_*ant 7 amazon-s3 amazon-web-services
我是 aws 的新手。我在存储桶中上传了一张图片
如果我尝试在浏览器中打开对象 url,则会出现以下错误。
下面是我配置我的存储桶的存储桶策略
{
"Version": "2012-10-17",
"Id": "Policy1566555268319",
"Statement": [
{
"Sid": "Stmt1566555264845",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::497899159094:user/DevUser"
},
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": "arn:aws:s3:::akirainfocombucket/*",
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "public-read"
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
以下是 CORS 配置
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Run Code Online (Sandbox Code Playgroud)
根据支持团队的建议,将阻止所有公共访问设置为关闭。
我希望可以在浏览器中访问对象链接..(只读)
需要帮助配置存储桶?
小智 24
我怀疑这可能需要权限来获取对象,以便您可以从 S3 中的 URL 查看图像。
我配置了存储桶策略,如下所示。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::delxpro.com/*"
}
]
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,查找“s3:GetObject”这一行。在您的操作属性中添加此行并检查它是否有效。
它将从 S3 检索对象,以便您可以从 URL 查看图像。
| 归档时间: |
|
| 查看次数: |
6749 次 |
| 最近记录: |