1
votes

I am using Django (Pyhton) framework deployed on AWS EC2 Ubuntu instance and sending email using BOTO and AWS SES service. Earlier my script used to work. But since few days I have encountered an error:

BotoServerError at /contact_us/
BotoServerError: 400 Bad Request
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
  <Error>
    <Type>Sender</Type>
    <Code>RequestExpired</Code>
    <Message>Request timestamp: Wed, 16 Mar 2016 16:57:21 GMT expired.  It must be within 300 secs/ of server time.</Message>
  </Error>
  <RequestId>368a4b97-eb97-11e5-bf2d-8ff0675b134d</RequestId>
</ErrorResponse>

Exception Location: /usr/local/lib/python2.7/dist-packages/boto/ses/connection.py in _handle_error, line 177

Server time: Wed, 16 Mar 2016 16:57:21 +0000

The SES is working on UTC and I have changed the time of EC2 to UTC as well. Help me how to solve this issue.

1

1 Answers

3
votes

Request timestamp: Wed, 16 Mar 2016 16:57:21 GMT expired. It must be within 300 secs/ of server time.

Since you said it is not working for few days, it is most likely due to recent daylight savings time. And it is likely you are not running ntp to sync your clock.

Try this: sudo ntpdate pool.ntp.org

which will sync your system clock. If you want to make sure the time sync happens periodically, then start the NTP daemon:

sudo service ntp stop
sudo ntpdate -s pool.ntp.org
sudo service ntp start