AccessDenied: User is not authorized to perform sts:AssumeRole
概要
IAMユーザーまたはロールが別のロールを引き受ける(AssumeRole)権限を持っていない場合に発生するエラーです。信頼ポリシーまたはIAMポリシーの設定が必要です。
エラーメッセージ
An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:iam::111111111111:user/my-user is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::222222222222:role/target-role
AccessDenied: Not authorized to perform sts:AssumeRole
原因
このエラーは以下の原因で発生します:
- 信頼ポリシーの不備: ターゲットロールがソースを信頼していない
- IAMポリシーの不足: ソースユーザー/ロールにAssumeRole権限がない
- アカウント間の設定ミス: クロスアカウントで両方の設定が必要
- 外部ID(ExternalId)の不一致: 必要な外部IDが提供されていない
- MFAが必要: AssumeRoleにMFA認証が必要
解決策
1. ターゲットロールの信頼ポリシーを設定
| |
2. ソースにAssumeRole権限を付与
| |
3. クロスアカウントの設定
| |
4. ExternalIdを指定してAssumeRole
| |
5. MFA付きでAssumeRole
| |
6. SDKでの使用
| |
よくある間違い
- 信頼ポリシーのPrincipalにIAMユーザーではなくルートアカウントを指定
- ソース側のポリシーでResource を
*にして特定ロールを指定していない - ExternalIdが設定されているのに提供していない
- セッション名に使用できない文字を含めている
デバッグ
| |
関連エラー
参考リンク
関連エラー
AWS の他のエラー
AccessDeniedException: User is not authorized
ECS CannotPullContainerError
IncompleteSignature: The request signature we calculated does not match
MissingAuthenticationToken: Missing Authentication Token
SignatureDoesNotMatch: The request signature we calculated does not match
UnrecognizedClientException: The security token included in the request is invalid
この記事は役に立ちましたか?