How to fix: The difference between the request time and the current time is too large

11,134

Solution 1

It says request time is: 7:57 am and server time is: 6:57 am.

Server time means the time at the AWS Server (S3).

and my AWS is in Ohio where the time is: 2:57 am.

This doesn't matter. AWS runs on Coordinated Universal Time (UTC). The servers in the various regions don't know what the time is, where they are.

Request time means the timestamp encoded into the request, generated wherever the code is running -- presumably your desktop/laptop in this case. It is coded in UTC.

However my local machine time is: 9:57 am (not using vagrant or any server).

Generally speaking, computers -- operating systems -- have two concepts that interact to answer the question of "what time is it?" --

  • what time is it now? and
  • what offset should I use when displaying times to the user? The offset is the time zone setting.

Both of these need to be correct... otherwise, your clock can simultaneously:

  • be set to the wrong time and
  • display the correct time

Your computer believes its clock is set to display the correct local time for a time zone that is UTC+2... so it is subtracting 2 hours from the displayed "local" time when signing the request (display 9:57, request time 7:57)... but if 9:57 am is your local time, then your time zone setting on your computer is incorrect, because you are actually in UTC+3, because the "server" (at Amazon) has the time showing as 6:57. Correcting your time zone setting and then adjusting the clock by one hour (if necessary) should resolve the issue.

Solution 2

You need to update the time on the AWS server and Local machine. Best way to do is to run ntpdate command to sync time.

Command:

sudo ntpdate -u in.pool.ntp.org

Solution 3

For me, I turned on Day Light Saving on my system and tried again and it worked. I turned off the Day Light Saving because makes the time over here late by 1 hour.

Depending on where you are on the planet, what worked for me is to reduced my system time by 1 hour.

Share:
11,134
Seio. E.
Author by

Seio. E.

Updated on June 05, 2022

Comments

  • Seio. E.
    Seio. E. almost 2 years

    I receive this error from AWS:

    App\Services\Exceptions\Exception thrown with message "Error in updated facebook event in the systemError executing "PutObject" on "n.jpg"; AWS HTTP error: Client error: PUT n.jpg resulted in a 403 Forbidden response: RequestTimeTooSkewedThe difference between the reque (truncated...) RequestTimeTooSkewed (client): The difference between the request time and the current time is too large. - RequestTimeTooSkewedThe difference between the request time and the current time is too large.20180403T075710Z2018-04-03T06:57:48Z900000"

    It says request time is: 7:57 am and server time is: 6:57 am.

    However my local machine time is: 9:57 am (not using vagrant or any server).

    and my AWS is in Ohio where the time is: 2:57 am.

    What do I change to fix this error ?

    I'm building a php/Laravel 5.5 project.

    • Option
      Option about 6 years
      Surely this is just a timezone fix? You can adjust the timezone within the config/app.php file
    • Seio. E.
      Seio. E. about 6 years
      It is set to my local time which is same as my local machine. I'll double check though. thnx.
    • Option
      Option about 6 years
      Generally, changing the timezone within your app.php will save the correct times to your database too. Double check you havent mistyped or anything.
  • Andrew
    Andrew over 2 years
    NTP does not use timezones or DST.