2016年8月20日土曜日

[AWS] aws-cli は時刻がずれていると動かない


aws-cli は、現在時刻とずれてると、エラーになります。

試しに、ntpd を停止して、時刻を過去に設定して、aws コマンドを実行すると、以下のようなエラーになります。

[root@localhost ~]# service ntpd stop
ntpd を停止中:                                             [  OK  ]
[root@localhost ~]# date
2016年  8月 20日 土曜日 11:00:51 JST
[root@localhost ~]# aws ec2 describe-instances
-------------------
|DescribeInstances|
+-----------------+
[root@localhost ~]# date -s "08/20 10:00 2016"
2016年  8月 20日 土曜日 10:00:00 JST
[root@localhost ~]# date
2016年  8月 20日 土曜日 10:00:06 JST
[root@localhost ~]# aws ec2 describe-instances

An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials
[root@localhost ~]#

時間が、ずれていると認証に失敗するようです。