无法访问AWS端点

时间:2013-11-21 13:29:08

标签: apache amazon-web-services amazon-ec2 cloud

我正在使用以下CURL命令通过deltacloud访问AWS api:

curl --user“accesskey:secretaccesskey”-H“X-Deltacloud-Driver:ec2”-H“X-Deltacloud-Provider:us-east-1”“http://IPofdeltacloud.com:3001/api/images?format=xml

但我一次又一次地听到错误:

Aws::AwsError:RequestExpired: Request has expired. Timestamp date is 2013-11-21T12:57:45.000Z
REQUEST=ec2.us-east-1.amazonaws.com:443/?AWSAccessKeyId=AKIAIQUAMKYUKBM2RDMA&Action=DescribeImages&Filter.1.Name=image-type&Filter.1.Value.1=machine&Owner.1=amazon&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-11-21T12%3A57%3A45.000Z&Version=2010-08-31&Signature=OfCOFQKH0lBMbHA4pofIBekmRfXEysAI%2F5c8YIjugUM%3D 
REQUEST ID=62efe75b-dbad-4a3c-bb0f-d49eaced2d78 
/usr/local/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/awsbase/awsbase.rb:579:in `request_info_impl'
/usr/local/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/ec2/ec2.rb:179:in `request_info'
/usr/local/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/awsbase/awsbase.rb:593:in `request_cache_or_info'
/usr/local/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/ec2/ec2.rb:207:in `ec2_describe_images'
/usr/local/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/ec2/ec2.rb:252:in `describe_images_by_owner'
/root/testgit/deltacloud/server/lib/deltacloud/drivers/ec2/ec2_driver.rb:155:in `block in images'
/root/testgit/deltacloud/server/lib/deltacloud/drivers/exceptions.rb:173:in `call'
/root/testgit/deltacloud/server/lib/deltacloud/drivers/exceptions.rb:173:in `safely'
/root/testgit/deltacloud/server/lib/deltacloud/drivers/ec2/ec2_driver.rb:154:in `images'
/root/testgit/deltacloud/server/lib/deltacloud/helpers/deltacloud_helper.rb:58:in `block in filter_all'
 /usr/local/lib/ruby/1.9.1/benchmark.rb:280:in `measure'

有谁能告诉我发生了什么错?

1 个答案:

答案 0 :(得分:0)

您的服务器有时间偏差,AWS会检查请求的时间戳,以防止重播攻击。

您必须在服务器上设置正确的时间。如果您正在运行ubuntu,则可以使用以下bash命令:

ntpdate ntp.ubuntu.com