19

I'm using

aws s3 sync ~/folder/ s3:// --delete

to upload (and sync) a large number of files to an S3 bucket. Some - but not all - of the files fail, throwing this error message:

upload failed: to s3://bucketname/folder/ A client error (RequestTimeTooSkewed) occurred when calling the UploadPart operation: The difference between the request time and the current time is too large

I know that the cause of this error is usually a local time that's out of sync with Internet time, but I'm running NTP (on my Ubuntu PC) and the date/time seem absolutely accurate - and this error has only been reported for about 15 out of the forty or so files I've uploaded so far. Some of the files are relatively large - up to about 70MB each - and my upload speeds aren't fantastic: could S3 possibly be comparing the initial and completion times and reporting their difference as an error? Thanks,

dfc
  • 723
  • 5
  • 16
dlanced
  • 941
  • 2
  • 9
  • 15
  • It doesn't matter how long your upload takes as S3 uses only the Date (or x-amz-date) header to compare times and it does not rely on the upload completion time. – dcro Sep 22 '14 at 05:57

6 Answers6

26

The time verification happens at the start of your upload to S3, so it won't be to do with files taking too long to upload.

Try comparing your system time with what S3 is reporting and see if there is any unnecessary time drift, just to make sure:

# Time from Amazon
$ curl http://s3.amazonaws.com -v

# Time on your local machine
$ date -u

(Time is returned in UTC)

TBoNE
  • 263
  • 2
  • 3
  • Thanks. I was only two seconds off...and that's with running the two commands one after the other. – dlanced Sep 23 '14 at 12:16
  • Faced this issue using Homestead laravel with vagrant difference was about 15minutes :O .... Did vagrant halt and vagrant up seems to be working fine after that... One of my junior had to restart the computer which worked for him. – BlackBurn027 Jan 03 '19 at 10:14
12

I was running aws s3 cp inside docker container on a MacBook Pro and got this error. Restart the Docker for Mac fixed this issue.

terry
  • 1,469
  • 11
  • 19
3

Amazon S3 uses NTP for its system clocks, to sync with your clock. Run

sudo apt-get install ntp

then open /etc/ntp.conf and add at the bottom

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

Then run service ntp restart

Kenan
  • 10,163
  • 8
  • 32
  • 47
2

It now seems that multipart uploads were failing on aws s3. Using s3cmd instead works perfectly.

dlanced
  • 941
  • 2
  • 9
  • 15
1

You have to sync you local time on your machine. The time is out of world time.

ilgam
  • 3,186
  • 1
  • 28
  • 25
  • Restarting the virtual machine worked for me. Not sure why it was not synced, but maybe is this happening when suspending the machine, rather than turning it down? – Kamafeather Oct 17 '19 at 11:09
0

I'm having the issue on MacOS. I fixed it by Preference -> Date & Time -> check the box "Set date and time automatically"

Gabriel Wu
  • 1,158
  • 13
  • 22