59
38

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 S3 で listObjects が "AccessDenied" を返す場合

Last updated at Posted at 2014-03-29

問題です

下記の IAM Role だと、 listObjects が 403 を返します。なぜでしょう?

{
    "Version": "2012-10-17", "Statement": [
       {
          "Action": [
               "*"
           ],
           "Resource": [
               "arn:aws:s3:::s3jstest/*"
           ],
           "Effect": "Allow"
        }
    ]
}

答え

ここがぬけてるからでしたーm9(^Д^)

           "Resource": [
               "arn:aws:s3:::s3jstest", // ←ここ
               "arn:aws:s3:::s3jstest/*"
           ]

理由

参考URLで知ったんですが、S3のAction一覧に listObjects なんて権限はなく、 listBucket の権限が必要になるとのことです。

確かに、APIドキュメントにも GET Bucket (List Objects) なんて書かれてます。

で、ワイルドカードで指定するだけだと、bucketに対するAPIはたたけないということで、listObjects もできないと、そういうことですね。

参考

http://qiita.com/rch850/items/068a323e50b906384930

2014/04/16 追記

PutObject や GetObject ではワイルドカードによる指定が必要みたいです。ぐぬぬ。

59
38
3

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
59
38

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?