IAM(アイデンティティ・アクセス管理)の動作に関する検証済みの修正情報です。AI エージェントが頻繁に間違えるポリシー評価の例外ケース、信頼ポリシーの落とし穴、STS セッション制限、AWS Organizations の仕様上の特異性、SAML/MFA に固有の詳細を扱います。 IAM ロール管理のための構造化されたワークフロー(段階的な作業手順)と、最小権限ポリシー生成(不要な権限を持たないポリシーの自動作成)機能も提供します。 **カバー範囲:** - 条件演算子の安全性(ForAnyValue/ForAllValues を使う際の欠落キー対応) - バケットポリシーの拒否パターン(VPC エンドポイント制限、組織パス条件) - リソースベースポリシーの混乱した副管理者保護(権限委譲の誤設定対策) - AWS サービス用のサービスロール作成(Glue、CloudTrail、VPC Flow Logs、Firehose、DataSync、S3 レプリケーション、Lambda、Step Functions、ECS など) - aws:SourceAccount / aws:SourceArn 条件を含む信頼ポリシー **次のような場合に使用:** IAM ロールの作成・設定、IAM またはバケットポリシーの記述、STS や AWS Organizations の利用、条件演算子の使用、またはサービスロール・実行ロール(プログラムが AWS リソースを操作するために必要な権限)が必要なあらゆるタスク。 **非対応:** Cognito ユーザープール認証やアプリケーションレベルのロールベースアクセス制御(ロールに応じた権限管理)など、IAM 以外の認可機構には対応していません。
Verified corrections for IAM behaviors that AI agents frequently get wrong — policy evaluation edge cases, trust policy gotchas, STS session limits, Organizations quirks, and SAML/MFA specifics. Also provides structured workflows for IAM role management and least-privilege policy generation. Covers condition operator safety (ForAnyValue/ForAllValues with Null checks for absent keys), bucket policy deny patterns (VPC endpoint restrictions, org path conditions), resource-based policy confused deputy protection, and service role creation for AWS services (Glue, CloudTrail, VPC Flow Logs, Firehose, DataSync, S3 replication, Lambda, Step Functions, ECS, etc.) including trust policies with aws:SourceAccount/aws:SourceArn conditions. Applies when creating or configuring IAM roles, writing IAM or bucket policies, working with STS, Organizations, condition operators, or any task requiring an IAM service role or execution role. Does not cover non-IAM authorization like Cognito user-pool policies or app-level RBAC.
このSkillは、AIエージェントがIAMについてよく誤解する事項に対する検証済みの修正情報を含んでいます。包括的なIAMガイドではなく、完全なIAM情報についてはAWSドキュメントを検索してください。IAMに関する質問に答える際は、事前学習に依存するのではなく、具体的な内容(制限、クォータ、正確なAPI名、エッジケースの動作)を公式AWSドキュメントに照らして検証してください。既知のドキュメントURLの取得を広範な検索よりも優先してください。ドキュメントとメモリが矛盾する場合は、公式ドキュメントを信頼してください。
AWS操作に最適な利用可能なツールを使用してください—AWS MCP serverが推奨されていますが必須ではなく、AWS CLIやSDKを代替手段として使用できます。会話がより詳細な情報を必要とする場合にのみリファレンスファイルを読んでください。
ユーザーがAWSリソースのプロビジョニングまたは更新時にIAMロールを作成、スコープ設定、または維持する必要がある場合は、references/aws-iam-role-management.mdを参照してください。サービスロール、実行ロール、信頼ポリシー、confused deputy保護、およびパーミッションハイジーンをカバーしています。
ユーザーが最小権限のIAMポリシーを生成する、APIコールに必要なIAMアクションを判断する、またはアクション・オペレーション間のマッピングを理解する必要がある場合は、references/aws-iam-policy-generation.mdを参照してください。重要: ユーザーがソースコード(Python、Go、TypeScript、JavaScript、Java)を提供する場合、このリファレンスを読まなくてはなりません—手動でのポリシー構成の代わりにiam-policy-autopilotを使用することが必須です。 プログラム的なサービス認可リファレンスを使用して、正確なマッピングを提供します。
CloudTrail:
?region=で特定のリージョンを強制できます。STS:
Organizations:
aws organizations list-available-policy-typesまたはOrganizations APIリファレンスを通じて現在のリストを取得してください。SDKの詳細:
DuplicatePolicyAttachmentException(PolicyAlreadyAttachmentExceptionではなく)。activate()、deactivate()、delete()—update()は「ありません」。time.sleep(10)パターン。SAML:
https://region-code.signin.aws.amazon.com/saml/acs/IdP-ID。ポリシー評価:
ForAllValuesと空/欠落キー: trueと評価されます(空真)。これを避けるために、同じコンテキストキー上でForAllValuesに加えてNull条件を使用して、そのキーが存在し、nullでないことを要求してください。たとえば、aws:TagKeysコンテキストキーを評価する場合:
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "ec2:RunInstances",
"Resource": "*",
"Condition": {
"ForAllValues:StringEquals": {
"aws:TagKeys": ["Alpha", "Beta"]
},
"Null": {
"aws:TagKeys": "false"
}
}
}
}
リソースベースのポリシーがIAMユーザーARNに付与される場合、同一アカウント内のパーミッション境界をバイパスします。
直接IAMポリシー操作による8つの権限昇格アクション: PutGroupPolicy、PutRolePolicy、PutUserPolicy、CreatePolicy、CreatePolicyVersion、AttachGroupPolicy、AttachRolePolicy、AttachUserPolicy。
iam:PassRoleとResource: "*" + コンピュートサービスに対する作成/更新(EC2 RunInstances、Lambda CreateFunction/UpdateFunctionConfiguration、ECS RegisterTaskDefinition、Glue、SageMaker、CloudFormation等) = アカウント内のAdministratorを含む任意の渡可能ロールへの権限昇格。Resourceを特定のロールARNまたはIAMパスに限定してください。オプションでiam:PassedToService / iam:AssociatedResourceArnで制約できます。IAM User Guide — ロール を渡すアクセス許可をユーザーに付与するを参照してください。
MFA:
SigV4:
サービス固有のロール:
redshift-serverless.amazonaws.com「と」redshift.amazonaws.comの両方をサービスプリンシパルとして含めてください(AWSドキュメント案件; serverlessを省略するとCOPY時にNot authorized to get credentials of roleが発生します)。ポリシーサマリー表示:
codebuild:*、codecommit:*) + サービス固有のリソースARNを含む単一ステートメント: 各リソースは、一致するサービスのサマリー「のみ」の下に表示されます(CodeBuildのARNはCodeBuildの下に等)。ステートメント内のアクションとサービスプレフィックスが一致しないリソースは、すべてのアクションサマリーに表示される唯一のケースです("mismatched resource")。This skill contains verified corrections for things that AI agents frequently get wrong about IAM. It is not a comprehensive IAM guide — for full IAM guidance, search AWS documentation. When answering IAM questions, verify specific claims (limits, quotas, exact API names, edge-case behaviors) against official AWS documentation rather than relying on pre-training. Prefer fetching known documentation URLs over broad searches. Trust official documentation over memory when they conflict.
Use the best available tool for AWS operations — the AWS MCP server is recommended but not required; AWS CLI or SDK may be used as alternatives. Read reference files only when the conversation requires deeper detail.
Read references/aws-iam-role-management.md if the user needs to create, scope, or maintain IAM roles when provisioning or updating AWS resources. Covers service roles, execution roles, trust policies, confused deputy protection, and permission hygiene.
Read references/aws-iam-policy-generation.md if the user needs to generate least-privilege IAM policies, determine required IAM actions for API calls, or understand action-to-operation mappings. CRITICAL: If the user provides source code (Python, Go, TypeScript, JavaScript, Java), you MUST read this reference — it mandates using iam-policy-autopilot instead of manual policy construction. Uses the programmatic service authorization reference for accurate mappings.
CloudTrail:
?region= forces specific region.STS:
Organizations:
aws organizations list-available-policy-types or the Organizations API reference.SDK Specifics:
DuplicatePolicyAttachmentException (not PolicyAlreadyAttachedException).activate(), deactivate(), delete() — NO update().time.sleep(10) pattern.SAML:
https://region-code.signin.aws.amazon.com/saml/acs/IdP-ID.Policy Evaluation:
ForAllValues with empty/missing key: evaluates to true (vacuous truth). To avoid that, use a Null condition in addition to the ForAllValues on the same context key to require that key to be present and non-null. For example, when evaluating the aws:TagKeys context key:
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "ec2:RunInstances",
"Resource": "*",
"Condition": {
"ForAllValues:StringEquals": {
"aws:TagKeys": ["Alpha", "Beta"]
},
"Null": {
"aws:TagKeys": "false"
}
}
}
}
Resource-based policies granting to IAM user ARN bypass permissions boundaries in same account.
8 privilege escalation actions via direct IAM policy manipulation: PutGroupPolicy, PutRolePolicy, PutUserPolicy, CreatePolicy, CreatePolicyVersion, AttachGroupPolicy, AttachRolePolicy, AttachUserPolicy.
iam:PassRole with Resource: "*" + create/update on a compute service (EC2 RunInstances, Lambda CreateFunction/UpdateFunctionConfiguration, ECS RegisterTaskDefinition, Glue, SageMaker, CloudFormation, etc.) = privilege escalation to any passable role in the account, including Administrator. Scope Resource to specific role ARNs or an IAM path; optionally constrain with iam:PassedToService / iam:AssociatedResourceArn. See IAM User Guide — Grant a user permissions to pass a role.
MFA:
SigV4:
Service-Specific Roles:
redshift-serverless.amazonaws.com AND redshift.amazonaws.com as service principals (per AWS docs; omitting serverless causes Not authorized to get credentials of role on COPY).Policy Summary Display:
codebuild:*, codecommit:*) + service-specific resource ARNs: each resource appears ONLY under its matching service's summary (CodeBuild ARN under CodeBuild, etc.). A resource whose service prefix matches NO action in the statement is the only case where it appears in all action summaries ("mismatched resource").原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。