Laravel 5 Amazon AWS S3 Error: Client error: 403 RequestTimeTooSkewed

I'm trying to upload files to an S3 bucket via a laravel app

I get the following error:

S3Exception in WrappedHttpHandler.php line 152: Error executing "PutObject" on "https://s3-ap-southeast-1.amazonaws.com/

AWS HTTP error: Client error: 403 RequestTimeTooSkewed (client): The difference between the request time and the current time is too large

I've done some research and many say that my my machine's time is not synced. I'm afraid of messing with homestead because im afraid of breaking something. Do i change my app timezone? Really not sure.

Please help and thank you for taking the time

Answers 1

  • You will need to update the clock on your homestead installation. You can do this using ntpd to ensure that this keeps your clock up to date as systems can suffer from a reasonable amount of time during reboots. On VMs this seems to be even more significant (but I am not sure of the details why).

    To get ntpd setup and running do the following in your homestead box;

    sudo apt-get install ntp
    

    Then you need to set your timeservers. Run the following;

    sudo nano /etc/ntp.conf
    

    Then make sure the file has the following contents;

    server ntp.ubuntu.com
    server pool.ntp.org
    

    Once you've saved those changes then run;

    sudo service ntp restart
    

    Once you have done this ntpd will take care of keeping your system clock correct minimising the risk of a drift error coming back from S3.

    Finally I would note not to worry too much about breaking your homestead environment as it is a virtual machine. The beauty of which is you can very easily rebuild it if you get something wrong.


Related Articles