Can any body say why I'm getting this error?
任何人都可以说我为什么会收到这个错误?
I'm getting this while pulling instances after connection to amazon server.
我在连接到amazon服务器后拉实例时得到了这个。
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>
2 个解决方案
#1
7
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.
boto(或任何其他AWS客户端库)发出的每个请求都经过加密签名,并且具有与之关联的时间戳(通常是请求中的Date头)。亚马逊关于当前时间的想法,时间戳必须合理地接近,通常在15分钟内。如果时间戳超出此可接受的窗口,您将收到类似的错误。
So, the short answer is to check the system time on the client machine. It appears to be inaccurate.
因此,简短的回答是检查客户端计算机上的系统时间。它似乎不准确。
#2
2
There's nice method to test for clock skew described on Amazon's forum.
亚马逊论坛上描述的测试时钟偏差的方法很好。
Type:
类型:
wget -S "https://email.us-east-1.amazonaws.com"
This returns an error, but includes the remote system's time in the Date header. Then compare that with the results of date
on your system (assuming it's unix derived).
这将返回错误,但包括Date头中的远程系统时间。然后将其与系统上的日期结果进行比较(假设它是unix派生的)。
If your OS happens to be Ubuntu or other Debian variant, you can keep the time current by installing an ntp daemon like this:
如果您的操作系统恰好是Ubuntu或其他Debian变体,您可以通过安装这样的ntp守护程序来保持时间最新:
sudo apt-get install ntp
#1
7
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.
boto(或任何其他AWS客户端库)发出的每个请求都经过加密签名,并且具有与之关联的时间戳(通常是请求中的Date头)。亚马逊关于当前时间的想法,时间戳必须合理地接近,通常在15分钟内。如果时间戳超出此可接受的窗口,您将收到类似的错误。
So, the short answer is to check the system time on the client machine. It appears to be inaccurate.
因此,简短的回答是检查客户端计算机上的系统时间。它似乎不准确。
#2
2
There's nice method to test for clock skew described on Amazon's forum.
亚马逊论坛上描述的测试时钟偏差的方法很好。
Type:
类型:
wget -S "https://email.us-east-1.amazonaws.com"
This returns an error, but includes the remote system's time in the Date header. Then compare that with the results of date
on your system (assuming it's unix derived).
这将返回错误,但包括Date头中的远程系统时间。然后将其与系统上的日期结果进行比较(假设它是unix派生的)。
If your OS happens to be Ubuntu or other Debian variant, you can keep the time current by installing an ntp daemon like this:
如果您的操作系统恰好是Ubuntu或其他Debian变体,您可以通过安装这样的ntp守护程序来保持时间最新:
sudo apt-get install ntp