Solved: Time Synchronization Issues with Amazon S3
Published: 22 Aug 2009
A while back I setup a script to create backups and store them on Amazon S3. Until recently, this has worked great. The script kept bombing with the following error when it actually tried to connect to S3 to upload the backup:
Creating new connection
Trying command list_bucket digitalsanctum-backups max-keys 200 prefix ciserver delimiter / with 100 retries left
Response code: 403
S3 command failed:
list_bucket max-keys 200 prefix ciserver delimiter /
With result 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeTooSkewed</Code><Message>The difference between the request time and the current time is too large.</Message><MaxAllowedSkewMilliseconds>900000</MaxAllowedSkewMilliseconds><RequestId>0782BA77E3493F61</RequestId><HostId>ZbUZGRklUQgijW8eN++LwqZwqW463U60yEaksoYx/IhSv2gkImT4JTFmKfPtShJc</HostId><RequestTime>Sat, 22 Aug 2009 18:44:00 GMT</RequestTime><ServerTime>2009-08-22T19:27:06Z</ServerTime></Error>
I’m not sure the reason why this happens (it may have something to do with the fact that the server in question is running as a virtual machine) but after some digging I realized the server I’m attempting to do the backup from had an inaccurate date.
To fix this you can run something like the following from the command prompt:
shane@ubuntu-ci:~/s3sync$ sudo ntpdate ntp.ubuntu.com [sudo] password for shane: 22 Aug 14:46:49 ntpdate[6296]: step time server 91.189.94.4 offset 2584.662208 sec
Generally, it’s also a good idea to have this setup as a daily cron job. If you’re running with Ubuntu, here are some instructions.
blog comments powered by Disqus