31 Aug 2010
I've recently done a proof of concept using RabbitMQ, Spring AMQP and Spring Integration. This...
21 Jul 2010
In over ten years of experience building software, there are patterns and nuances that you...
13 Jul 2010
I set out to find an elegant solution to providing growl notifications for a JRuby...
05 May 2010
I've started playing around with Heroku lately and ran into an issue when I created...
30 Apr 2010
I've been meaning to investigate something that came to mind a while back and just...

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