LoginSignup
26
17

More than 5 years have passed since last update.

aws sdk でアップロードしようとしたら、RequestTimeTooSkewedというエラーが出た場合の対処方法

Posted at

環境

Vagrant
VirtualBox
CentOS 6.5
Rails 4.1
Carrierwave

こんなエラーがでました。

Excon::Errors::Forbidden - Expected(200) <=> Actual(403 Forbidden)
excon.error.response
  :body          => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>RequestTimeTooSkewed</Code><Message>The difference between the request time and the current time is too large.</Message><RequestTime>20150127T094834Z</RequestTime><ServerTime>2015-01-27T10:05:26Z</ServerTime>

注目すべきは

<RequestTime>20150127T094834Z</RequestTime>

<ServerTime>2015-01-27T10:05:26Z</ServerTime>

ズレがすごい

awsと開発サーバー間で時間のズレが大きいらしい

なので、ntpを開発サーバー側にちゃんと設定すればうまくいくはず。

install

$ sudo yum -y install ntp

configure

$ sudo vi /etc/ntp.conf
----

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
↓コメントアウトをとる
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org

↓ 時刻同期先NTPサーバーを変更

server ntp.nict.jp
server ntp.jst.mfeed.ad.jp

adjust

$ sudo ntpdate ntp.nict.jp

setup

centos7
$ sudo systemctl start ntpd
$ sudo systemctl enable ntpd
centos5,6
$ sudo /etc/rc.d/init.d/ntpd start
ntpd を起動中:                                             [  OK  ]

$ sudo chkconfig ntpd on

結果

うまくいきました。

reference

26
17
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
26
17