54

I'm using the aws-sdk-php, the SesClient specifically, i've deployed an app in a customer server (hosted in DreamHost) and I'm getting this error:

Signature not yet current: 20130909T170846Z is still later than 20130909T170823Z (20130909T170323Z + 5 min.)

I'm guessing the server time is misconfigured, I'm trying to reach DH support to check on that, i bet that will take a while.

Any other ideas? The app has been deployed many times before and i've never seen this error.

xmarcos
  • 3,298
  • 2
  • 20
  • 27
  • If someone is looking, here is an Amazon guide for dealing with the issue https://aws.amazon.com/premiumsupport/knowledge-center/system-clock-drift-ubuntu/ – TomTom Nov 03 '17 at 12:49
  • 1
    this link is no longer working. its broken. – Sravan Jan 11 '21 at 05:28

10 Answers10

60

I had the similar issue. I was running my CI server from an Ubuntu EC2 instance and that has the time out of sync. I synchronised the time with NTP suing

sudo ntpdate ntp.ubuntu.com

It started working fine.

Kamrul
  • 7,175
  • 3
  • 31
  • 31
16

If you are using windows, just set the current time and time zone automatically. It will resolve the issue.

enter image description here

Suraj Nair
  • 1,729
  • 14
  • 14
  • Thanks for this! Works on Mac as well (System Preferences > Date & Time > Unlock in the bottom left > Check "set date and time automatically") – Bryce Dec 27 '20 at 20:21
  • 1
    You also have to click on "Synchronize clock" (or something similar) below to make it work – matteoh Apr 05 '21 at 07:46
  • Thanks! I was testing something by changing my time, didn't realize it could be the root cause. – Anveeg Sinha May 17 '22 at 04:57
10

I just encountered the same problem with a Django app deployed to AWS. The site error was really vague, but the error log that was emailed to me said, "JSONResponseError: JSONResponseError: 403 Forbidden {'message': 'Signature not yet current: 20150224T185106Z is still later than 20150224T185033Z (20150224T184533Z + 5 min.)'}" after a file path that pointed to Boto and Elastic Transcoder. Do the following on the server:

  1. ntpq -p will tell you if you have ntp installed
  2. If you don't have ntp, do sudo apt-get install ntp
  3. sudo service ntp stop
  4. sudo ntpdate -s us.pool.ntp.org will align your server's time with atomic clocks in the U.S. (this will need to be adjusted to your country)
  5. sudo service ntp start

Good luck! You can read more here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html#configure_ntp

Amit Thawait
  • 4,862
  • 2
  • 31
  • 25
Michelle Glauser
  • 1,097
  • 16
  • 28
10

I had the same issue recently. I did the following

sudo ntpd -q -g

The -g option is needed if your clock is way out of sync. It forces ntpd to continue till it's in sync.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Bish
  • 101
  • 1
  • 2
3

I faced similar issue and after some investigation, found the root cause.

Reason was that, my AWS instance/server timezone and my local system timezone from where i was making RESTful call were different. AWS assumes that request is also being made from the same timezone (it just ignore gap of 5 mins, not more than that). I was able to validate this by making test call from the AWS console and checking details in the logs (giving below Java snippet)

private String getDateString() {
    Calendar cal = Calendar.getInstance();
    DateFormat dfm = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
    dfm.setTimeZone(TimeZone.getTimeZone("UTC"));  //server timezone
    return dfm.format(cal.getTime());
}
rai.skumar
  • 10,309
  • 6
  • 39
  • 55
2

Just need to be sure the time of you server is 5 minutes accuracy from current time. check the AM or PM time.

Duvan
  • 341
  • 2
  • 6
2

For windows , check your time and timezone is correct. Time of your PC must be 5 minutes accuracy from current time.

0

I have used the following for converting date to AWS request format.

String getAWSCompatibleDate() {
    var date = DateTime.now().toUtc();
    String formattedDate = DateFormat('yyyyMMddTHHmmss').format(date);
    var newDate = "$formattedDate" + "Z";
    print("Date - $date");
    print("New Date - $newDate");
    return newDate.toString();
  }
Sravan
  • 1,891
  • 4
  • 23
  • 28
0

On Centos6, check if the ntpd service is running.

service ntpd status service ntpd start

it worked fine, after this.

Vikas
  • 1
  • 1
0

In my case my laptop's time was not matching to my time zone when i made a sync between my laptop's time and time zone this error was gone and it started working fine

Deepak
  • 2,287
  • 1
  • 23
  • 30