0
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?

【AWS】S3バケットポリシー作成時に「Invalid principal in policy 」エラーが出た場合

Posted at

概要

S3バケットとバケットポリシーを記載したCloudformationテンプレートをアップロードしたら、以下のエラーになりました。

Resource handler returned message: "Invalid principal in policy (Service: S3, Status Code: 400, Request ID: xxxxxxxxxx, Extended Request ID: xxxxxxxxxxxxxxxxxxxx) (SDK Attempt Count: 1)" (RequestToken: xxxxxxxxxxxxxxxxxxxx, HandlerErrorCode: GeneralServiceException)

原因と解決方法

エラーメッセージは、Principalの指定が間違っていると言っていますね。
ということで私が書いたコードを見てみると、以下のようにしていました。

            Principal:
              AWS: "arn:aws:iam::{AWS accountのID}:user/*"

自分のAWS環境のユーザであれば誰でも触れていいよ、と思いワイルドカードを使ったのですが、どうやらこれがNGだったらしい。

Principalには実在するIAMユーザーやロールのARNを指定する必要があるとのこと。

もしくは代わりに

"arn:aws:iam::582318560864:root"

を入れてもOKです。"arn:aws:iam::582318560864:root" は「そのAWSアカウントの全権限」を意味しています。
東京リージョン以外だと別の値になります。詳細は公式ドキュメントをご参照ください。

0
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
0
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?