Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

S3 RequestTimeTooSkewed error due to local machine's clock skew

While working on my local machine I have been trying to upload images (which uploads them immediately to the amazon server), but it was giving me a bug (RequestTimeTooSkewed Error using PHP S3 Class), I could figure out that it's a time zone issue and that S3 uses the current time zone to authenticate request, do I need to set up or change any configuration on the EC2 server to be able to upload images locally?

like image 932
Mainhattan Avatar asked Mar 13 '13 11:03

Mainhattan


4 Answers

Sync your clock with an NTP time server. All modern OS's support this.

Wherever you're uploading from is the machine that needs to be synced.

like image 81
Ryan Parman Avatar answered Nov 16 '22 12:11

Ryan Parman


Check your time synchronization on your ec2 instance. Due to the nature of virtual machines, the clock can skew over time. S3 does not allow requests that are more than a few minutes off.

like image 23
datasage Avatar answered Nov 16 '22 12:11

datasage


Running code from a virtual machine, had to do sudo ntpdate ntp.ubuntu.com to sync, and it worked.

like image 1
Yuri Astrakhan Avatar answered Nov 16 '22 11:11

Yuri Astrakhan


Restarting the ntp service usually fixes this:

sudo service ntpd restart

See also: How to force a clock update using ntp?

like image 1
smci Avatar answered Nov 16 '22 10:11

smci