LoginSignup
1

More than 3 years have passed since last update.

amplifyのIAMユーザに適切なポリシーを設定したい

Last updated at Posted at 2020-09-18

amplify configureを実行するとIAMユーザが作られます。

Specify the username of the new IAM user:
? user name:  amplify-AAAAA

amplifyチュートリアル的な記事などでは、このIAMユーザに管理者権限を振っていることが多い気がします。でも、なんかちょっと気持ち悪いですよね。適当に権限を制限しておきたいと思って調べたところ、以下を見つけました。

ADVANCED WORKFLOWS IAM Policy
https://docs.amplify.aws/cli/usage/iam

The Amplify CLI requires the below IAM policies for performing actions across all categories. You can grant or restrict category permissions by including or removing items from the Action section as appropriate. For example, if you wish to restrict operations on the Auth category you can remove any of the lines starting with cognito.

このページに書かれているJSONで権限を制限してみたところ、amplify pushで以下のエラーが発生。

Following resources failed

Resource Name: GraphQLAPI (AWS::AppSync::GraphQLApi)
Event Type: create
Reason: User: arn:aws:iam::xxx:user/amplify-AAAAA is not authorized to perform: appsync:TagResource on resource: arn:aws:appsync:ap-northeast-1:xxx:* (Service: AWSAppSync; Status Code: 403; Error Code: AccessDeniedException; Request ID: xxx; Proxy: null)

確かにJSONにはappsync:TagResourceが記載されていなかったので追加したところ、無事にpushも成功しました。

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
1