为什么我来自 Amazon S3 的图像 url 具有 AWSaccesskey 和过期时间,即使我创建了存储桶 public?
Why does my image url from Amazon S3 have AWSaccesskey and expiration even though I made the bucket public?
这是我添加的政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MakeItPublic",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucketname/*"
}
]
}
我创建了一个 IAM 并将 AmazonS3FullAccess 附加到该 IAM。
在我的 rails 应用程序中,我这样显示图片:
- @pictures.each do |picture|
%img{src: picture.image_url}
生成的 url 类似于:
https://leaguedraw.s3-us-west-2.amazonaws.com/uploads/73dfe6c6-0c25-496c-be9f-6f2beb75d7c3.png?AWSAccessKeyId=myaccesskey&Expires=1434472944&Signature=d1vIYOQt410%2BgcXs6%2BATSCsG2Mk%3D
当我只想要这个时:
https://leaguedraw.s3-us-west-2.amazonaws.com/uploads/73dfe6c6-0c25-496c-be9f-6f2beb75d7c3.png
我还需要做什么才能生成后者url?
附加信息:使用载波 gem 和载波 aws gem
原来我需要更改配置文件中的acl
config.aws_acl = :'public-read'
至
config.aws_acl = :public_read
尽管文档说要使用 :'public-read'
。
这是我添加的政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MakeItPublic",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucketname/*"
}
]
}
我创建了一个 IAM 并将 AmazonS3FullAccess 附加到该 IAM。
在我的 rails 应用程序中,我这样显示图片:
- @pictures.each do |picture|
%img{src: picture.image_url}
生成的 url 类似于:
https://leaguedraw.s3-us-west-2.amazonaws.com/uploads/73dfe6c6-0c25-496c-be9f-6f2beb75d7c3.png?AWSAccessKeyId=myaccesskey&Expires=1434472944&Signature=d1vIYOQt410%2BgcXs6%2BATSCsG2Mk%3D
当我只想要这个时:
https://leaguedraw.s3-us-west-2.amazonaws.com/uploads/73dfe6c6-0c25-496c-be9f-6f2beb75d7c3.png
我还需要做什么才能生成后者url?
附加信息:使用载波 gem 和载波 aws gem
原来我需要更改配置文件中的acl
config.aws_acl = :'public-read'
至
config.aws_acl = :public_read
尽管文档说要使用 :'public-read'
。