我已经设置了以下信息:
AccessDenied
拒绝访问
我从上述过程中获得了签名URL,例如
image.png?policy = xxxxx @ signature = xxx @ Key-Pair-Id = XXXXXXX
但是我无法访问URL
用于云前端策略的JSON示例
{
"Statement": [{
"Resource": "XXXXXXXXXX.cloudfront.net/standard/f7cecd92-5314-4263-9147-7cca3041e69d.png",
"Condition": {
"DateLessThan": {
"AWS:EpochTime": 1555021200
},
"IpAddress": {
"AWS:SourceIp": "0.0.0.0/0"
},
"DateGreaterThan": {
"AWS:EpochTime": 1554848400
}
}
}]
}
添加了CloudFront存储桶策略
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXXXXXXXXXXXXX"
},
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::bucket_name/*"
},
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXXXXXXXXXXXXX"
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::bucket_name"
}
]
}
答案 0 :(得分:0)
您似乎看到的AccessDenied错误与您提到的步骤无关,它是Origin访问身份,它允许CloudFront使用特殊用户使用sigv4访问S3,使用上述步骤,您将看到添加到存储桶策略中的allow语句。
如果这是S3的错误,您会看到2个请求ID,主机和请求ID,以及访问被拒绝的消息。
image.png?policy = xxxxx @ signature = xxx @ Key-Pair-Id = XXXXXXX 如果您看到访问被拒绝,则该错误与CloudFront签名的URL(受限的查看器访问)有关。
要查看生成的CloudFront签名URL有什么问题,请尝试对基准值进行base64解码,并查看资源URL /过期等是否正确。