Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

環境

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

http://centossrv.com/ntp.shtml

colorrabbit
creator.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした