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?
S3 RequestTimeTooSkewed error due to local machine's clock skew
Asked Answered
It doesn't mention S3 RequestTimeTooSkewed, but same issue as How to force a clock update using ntp? –
Huberthuberto
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.
You can find a list of NTP servers here: pool.ntp.org/en/use.html And you can run this from your source machine
sudo ntpdate 0.pool.ntp.org
–
Deviation 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.
Running code from a virtual machine, had to do sudo ntpdate ntp.ubuntu.com
to sync, and it worked.
Restarting the ntp service usually fixes this:
sudo service ntpd restart
See also: How to force a clock update using ntp?
sudo ntpdate -s time.nist.gov
This will set your local machines time to current time... you can change your timezone after local time is correct.
© 2022 - 2024 — McMap. All rights reserved.