LoginSignup
10
4

More than 5 years have passed since last update.

AWS CLIでRequestTimeTooSkewedエラーが発生した時の対処法

Last updated at Posted at 2019-02-19

VirtualBoxで構築したUbuntu環境にAWS CLIをインストールし、実行してみたところ以下のエラーが発生しました。

$ aws s3 ls
An error occurred (RequestTimeTooSkewed) when calling the ListObjectsV2 operation: The difference between the request time and the current time is too large.

調べてみたところ、実行環境のシステム時間と現在時間が大きくズレていると発生するようです。

システム時間確認

dateコマンドで時間確認

$ date
Tue Feb 19 06:05:09 UTC 2019

2019年2月19日15:20頃が実行したタイミングの日本時間だったので、9時間15分と確かに大きくズレていました。

タイムゾーン設定

まずは時差による9時間のズレを直すため、timedatectlコマンドでタイムゾーンを東京に設定します。

$ timedatectl set-timezone Asia/Tokyo
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-timezone ===
Authentication is required to set the system timezone.
Authenticating as: vagrant,,, (vagrant)
Password:
==== AUTHENTICATION COMPLETE ===
$ date
Tue Feb 19 15:06:40 JST 2019

時刻微調整

続いて分単位の時刻設定を行おうとしましたが...

$ timedatectl set-time "2019-02-19 15:25:00"
Failed to set time: Automatic time synchronization is enabled

同期設定が有効になっているため失敗しました。
一旦同期設定をOFFにし、再度時刻設定を行います。

$ timedatectl set-ntp no
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
                network time synchronization shall be enabled.
Authenticating as: vagrant,,, (vagrant)
Password:
==== AUTHENTICATION COMPLETE ===
$ timedatectl set-time "2019-02-19 15:27:00"
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-time ===
Authentication is required to set the system time.
Authenticating as: vagrant,,, (vagrant)
Password:
==== AUTHENTICATION COMPLETE ===

今度は時刻設定に成功しました。
同期設定を有効に戻します。

$ timedatectl set-ntp yes
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
                network time synchronization shall be enabled.
Authenticating as: vagrant,,, (vagrant)
Password:
==== AUTHENTICATION COMPLETE ===

念のため時刻とタイムゾーンが正しいか確認します。

$ timedatectl status
                      Local time: Tue 2019-02-19 15:27:52 JST
                  Universal time: Tue 2019-02-19 06:27:52 UTC
                        RTC time: Tue 2019-02-19 06:27:53
                       Time zone: Asia/Tokyo (JST, +0900)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

AWS CLI動作確認

改善したか確認します。

$ aws s3 ls
2019-02-19 14:18:00 ***************
2018-10-09 16:35:28 ***************
2019-01-12 21:45:34 ***************
(伏字はS3バケット名)

無事結果が返ってくるようになりました。

10
4
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
10
4