当我尝试使用命令AssetSync.sync
或rake assets:precompile
与s3异步资产时
这会引发错误
Excon::Error::Forbidden: Expected(200) <=> Actual(403 Forbidden)
excon.error.response
:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>`
S3存储桶策略为:
{
"Id": "xxx",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "xxx",
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::static-assets",
"Principal": "*"
},
{
"Sid": "xxx",
"Action": [
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::static-assets/*",
"Principal": "*"
}
]
}
如何解决此问题?