Client.InvalidSecurity: Request has expired

Ported from old site.
 
Here's a quick note for anyone using Amazon EC2.
 
I use a script to automatically create EC2 snapshots a la ec2-create-snapshot ... this then sends me an email notifying me that the snapshots have been started.  Today I got a email that looked like:
 
Client.InvalidSecurity: Request has expired
Client.InvalidSecurity: Request has expired
 
Sure enough, no snapshots created. The problem is too much time difference between the actual EC2 server and my instance.  An easy thing to fix.
 
Simplest way is to install NTP:
 
sudo apt-get install ntp
If you dont want to use NTP -- and I'm not sure why you wouldn't, any examples? -- change the datetime manually.
 
sudo date newdatetimestring
wherenewdatetimestringhas to follow the formatnnddhhmmyyyy.sswhich is described below
 
nnis a two digit month, between 01 to 12
ddis a two digit day, between 01 and 31, with the regular rules for days according to month and year applying
hhis two digit hour, using the 24-hour period so it is between 00 and 23
mmis two digit minute, between 00 and 59
yyyyis the year; it can be two digit or four digit: your choice. I prefer to use four digit years whenever I can for better clarity and less confusion
ssis two digit seconds. Notice the period ‘.’ before the ss.
Let’s say you want to set your computer’s new time to December 6, 2007, 22:43:55, then you would use:
 
sudo date 120622432007.55
Easy as pie.