在使用Amazon拉实例时出现400错误的请求 [英] 400 Bad Request while pulling instances with amazon

查看:331
本文介绍了在使用Amazon拉实例时出现400错误的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以说出我为什么出现此错误吗?

Can any body say why I'm getting this error?

在连接到亚马逊服务器后拉实例时,我遇到了这个问题.

I'm getting this while pulling instances after connection to amazon server.

import boto

con = boto.connect_ec2(aws_access_key_id='XXX',aws_secret_access_key='XXX')
con.get_all_instances()

Traceback (most recent call last):

  File "getAllinstanc.py", line 7, in <module>

    reservations = ec2conn.get_all_instances()

  File "c:\jiva\py26\lib\site-packages\boto-2.3.0-py2.6.egg\boto\ec2\connection.py", line 467, in get_all_instances

    [('item', Reservation)], verb='POST')
  File "c:\Jiva\py26\lib\site-packages\boto-2.3.0-py2.6.egg\boto\connection.py", line 896, in get_list

    raise self.ResponseError(response.status, response.reason, body)

boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request

<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>RequestExpired</Code><Message>Request has expired. Timestamp date is 2012-04-09T06:54:53Z</Message></Error></Errors><RequestID>44
08be18-5d2b-420b-af48-e2cb03</RequestID></Response>

推荐答案

boto(或任何其他AWS客户端库)发出的每个请求均经过加密签名,并带有与之关联的时间戳(通常是请求中的Date标头).时间戳必须与亚马逊当前时间的想法合理地相吻合,通常在15分钟之内.如果时间戳不在此可接受的时间范围内,您将收到这样的错误.

Each request made by boto (or any other AWS client library) is cryptographically signed and has a timestamp associated with it (usually the Date header in the request). The timestamps have to be reasonably close, usually within 15 minutes, of Amazon's idea of the current time. If the timestamp is outside this acceptable window, you will receive an error like this.

因此,简单的答案是检查客户端计算机上的系统时间.看来不正确.

So, the short answer is to check the system time on the client machine. It appears to be inaccurate.

这篇关于在使用Amazon拉实例时出现400错误的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆