How to fix Amazon S3-RequestTimeTooSkewed


AllCloud Blog:
Cloud Insights and Innovation

If you are uploading data to Amazon S3, you may at some point come across an error of RequestTimeTooSkewed type,  stating that : The difference between the request time and the current time is too large 

Here’s how to quickly understand and solve it .

S3 uses NTP to maintain accurate system clocks , and your client machine’s clock is out of sync with the Amazon time .

So you need to install NTP , or if already installed and running, just update the server pools to the Amazon ones.

– To install NTP , simply choose one of the bellow, depending on your distribution:

apt-get install ntp 
or
yum install ntp

– Configure NTP to use amazon servers , like so :

vim /etc/ntp.conf

And in it , comment out the default servers and add these:

server 0.amazon.pool.ntp.org iburst
server 1.amazon.pool.ntp.org iburst
server 2.amazon.pool.ntp.org iburst
server 3.amazon.pool.ntp.org iburst

*The iburst option is recommended, and sends a burst of packets only if it cannot obtain a connection with the first attempt. The burst option always does this, even on the first attempt, and should never be used without explicit permission and may result in blacklisting.

Restart NTP :

service ntpd restart

–  To check that you are now in sync,  you can compare your server’s time with s3.amazonaws.com, like so :

Get your GMT time:

date -u

Then compare it to the date header received from the bellow :

Type these commands, followed by 2 newlines :

telnet s3.amazonaws.com 80
GET / HTTP/1.0

The output should look similar to this :

telnet s3.amazonaws.com 80
Trying 205.251.242.241...
Connected to s3.amazonaws.com.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 307 Temporary Redirect
x-amz-id-2: 3PtvRibd87aJd0K1oPQRwikPsAJ9RhtUGZXrXxEpK4yy4j/YRcdPd3k1l/zOokCt
x-amz-request-id: FDDE5F89A704CB98
Date: Tue, 13 May 2014 08:52:52 GMT
Location: https://aws.amazon.com/s3
Content-Length: 0
Connection: keep-alive
Server: AmazonS3

You can also issue

ntpstat

to check if you are in sync.

This should get you rid of the RequestTimeTooSkewed error .

AllCloud Expert

Read more posts by AllCloud Expert