2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

aws-cliやaws-sdkが動かない時は時刻が正しいか確認する(原因と対応)

Last updated at Posted at 2019-04-17

VirtualBox等の仮想化環境でawsコマンド(aws-cli)やaws-apiライブラリを使用したシステムよりAWSの各種APIへアクセスすると、次のようにエラーが表示される場合があります。

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

特に、ノートPCの場合はその現象が顕著に発生する傾向があります。

原因

ノートPCでVM起動中にスリープ(サスペンド、ハイバネーション)を行うと、スリープ復帰後に時刻ずれが生じる場合があります。

スリープ復帰後は時刻が自動的に補正されない場合があるため、次のいずれかの対応が必要となります。

A)手動で時刻補正を行う
B)VMを一旦停止(シャットダウン)してから起動し直す

対応

ここでは、Aの方法をもとに説明を進めます。

1.時刻が正しいか確認します

Linux(VM)の日時を確認します。

# date
Thu Apr 18 00:05:58 JST 2019

次に、ホストOSの日時を確認します。
image.png

以上を見てみると、ホストOSとVMで異なる時刻を示していることがわかります。

2.時刻を合わせます

ntpdateで時刻を合わせます。(以下はNICTのタイムサーバを使用する例です)

# ntpdate ntp.nict.jp

上記コマンドを実行すると、次のように結果が返され、時刻が補正されます。

18 Apr 01:21:42 ntpdate[15103]: step time server 133.243.238.243 offset 4325.436029 sec

3.awsコマンドを実行する

awsコマンドで何らか実行を行い、意図した結果が返ってくれば解決となります。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?