Reputation:
I'm trying to set up s3 for the first time and trying to run the sample file that comes with the PHP sdk that creates a bucket and attempts to upload some demo files to it. But this is the error I am getting:
The difference between the request time and the current time is too large.
I read on another question on SO that this is because Amazon determines a valid request by comparing the times between the server and the client, that the 2 must be within a 15 min span of one another.
Now here is the problem. My laptop's time is 12:30AM June 8, 2012
at the moment. On my server I created a file called servertime.php and placed this code in that file:
<?php
print strftime('%c');
?>
and the output is:
Fri Jun 8 00:31:22 2012
It looks like the day is correct but I don't know what to make of 00:31:22
. In any case, how is it possible to always make sure the time between the client and server is within a 15 minute window of one another. What if I have a user in China who wishes to upload a file on my site which uses s3 for the cdn. Then the time difference would be over a day. How can I make sure all my user's times are within 15 minutes of my server time? What if the user is in the U.S. but the time on their machine is misconfigured.
Basically how to get s3 bucket creation and upload to work?
Upvotes: 2
Views: 911
Reputation: 11962
Place your EC2 instance and your S3 bucket inside the same region and make sure your server has the correct time:
Debian/Ubuntu
// install ntp
apt-get install ntp ntpdate
CentOS/Fedora
// install ntp
yum install ntp
// turn on service
chkconfig ntpd on
// synchronize system clock with 0.pool.ntp.org server
ntpdate pool.ntp.org
// start ntp
/etc/init.d/ntpd start
That should fix your problems.
Upvotes: 4