S3 Error: The difference between the request time and the current time is too large

I have error The difference between the request time and the current time is too large when call method amazons3.ListObjects

ListObjectsRequest request = new ListObjectsRequest() {
    BucketName = BucketName, Prefix = fullKey 
}; 
using (ListObjectsResponse response = s3Client.ListObjects(request))
{
    bool result = response.S3Objects.Count > 0;

    return result;
}

What it could be?


Solution 1:

The time on your local box is out of sync with the current time. Sync up your system clock and the problem will go away.

Solution 2:

For those using Vagrant, a vagrant halt followed by vagrant up worked for me.

Solution 3:

The clock is out of sync.

I followed the steps in this post to get it working again, but also had to run the following command.

sudo ntpdate ntp.ubuntu.com
sudo apt-get install ntp

If at any time you get a message saying the NTP socket is still in use, stop it with sudo /etc/init.d/ntp stop and re-run your command.

Solution 4:

I had the same error and I'm using Docker for Mac. Simply restarting Docker worked for me.

Solution 5:

For those using Docker in Windows try restarting the Docker Engine in Setting->Reset->Restart Docker.