EC2 API Error validating access credential

Run aws s3 ls to confirm whether the error is related to time sync. You should get the error like:

An error occurred (RequestTimeTooSkewed) when calling the ListBuckets operation: The difference between the request time and the current time is too large.

If so, try to sync your datetime as suggested.

Example shell commands on Linux to do that:

# Install the ntpdate client for setting system time from NTP servers.
sudo apt-get --yes install ntpdate
sudo ntpdate 0.amazon.pool.ntp.org

Then re-try your aws command again.


If the timezone is still not correct, run: sudo dpkg-reconfigure tzdata to configure it, or by:

timedatectl list-timezones
timedatectl set-timezone 'Europe/London'

See also: Configure localtime. dpkg-reconfigure tzdata.


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.


Check that the server clock is synchronized.

If the clock is delayed, can cause this error:

AWS was not able to validate the provided access credentials