I installed the ec2 api following the amazon guide. I setted up the access id and secret as environment variable.
Here it is my profile:
expor
I ran into this issue when my system clock was set falsely.
In my case the clock was running ahead by two hours.
Equally important is to put the commands in your .bashrc or similar file (.bash_aliases):
export AWS_ACCESS_KEY="XXXXXXXXXXXXXXXXX"
export AWS_SECRET_KEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
When there run source ~/.bashrc
The reason for the importance of this is that when running an ec2 command new shell instances are created that doesn't get the environment variables otherwise.