我试图用Fog列出S3存储桶的内容,但是会出现持续错误:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
EC2实例
IAM角色“S3BucketAccess”:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*"
],
"Resource": [
"arn:aws:s3:::*",
"arn:aws:s3:::mybucket/*",
"arn:aws:s3:::mybucket/deploy",
"arn:aws:s3:::mybucket/deploy/*"
]
},
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
}
]
}
169.254.169.254/latest/meta-data/iam/security-credentials/S3BucketAccess
{
"Code" : "Success",
"LastUpdated" : "2013-06-28T11:54:08Z",
"Type" : "AWS-HMAC",
"AccessKeyId" : "XXXXXXXXXX",
"SecretAccessKey" : "YYYYYYYYYY",
"Token" : "ALongToken",
"Expiration" : "2013-06-28T18:15:09Z"
}
Ruby代码:
require 'rubygems'
require 'fog'
connection = Fog::Storage::AWS.new({:use_iam_profile => true})
p connection.directories
使用上面提到的错误代码获取令人讨厌的错误消息/堆栈跟踪。
答案 0 :(得分:1)
你使用的是什么版本的雾?你可以从错误中抓取并分享身体吗?它通常具有“预期”与“已接收”签名的东西,可以极大地帮助签名问题。谢谢!
答案 1 :(得分:1)
雾1.14.0发布于2013年7月19日,其中有解决方案(问题1923是https://github.com/fog/fog/pull/1940的结果)。此更新解决了该问题。