管理アカウントの IAM ロール (以下、管理用IAMロール) とは、Cloud Automator が AWS Organizations 連携を行う際に、管理アカウント上に作成される IAM ロールです。
このロールを通じて、Cloud Automator は組織の構造情報の取得や、メンバーアカウントへの IAM ロール展開を行います。
ロールの目的
AWS Organizations 連携では、Cloud Automator が管理アカウントに対して以下の操作を行う必要があります。
- 組織に所属する OU やアカウントの情報を取得する
- 各メンバーアカウントに IAM ロールを展開する
- 各メンバーアカウントの IAM ロール権限を最新の状態に更新する
- 展開先として利用可能な AWS リージョンの一覧を取得する
これらの操作を安全に実行するため、管理用IAMロールを作成し、Cloud Automator がそのロールを引き受ける(AssumeRole)形で操作を行います。
ロールの権限
管理用IAMロールに付与される権限は、上記の操作に必要な最小限に限定されています。
AWS Organizations に対しては読み取り専用であり、組織の設定変更やアカウントの作成・削除を行う権限は含まれていません。
CloudFormation の更新系権限についても、Cloud Automator が管理する StackSet 関連のリソースのみを対象としています。
ロールの名前
管理用IAMロールの名前は CloudAutomator-Organizations-Management-Role です。
AWS Organizations 連携の設定時(STEP3)に作成される CloudFormation スタックによって、この名前で IAMロールが自動的に作成されます。
管理用IAMロールに付与されるポリシー
管理用 IAM ロールに付与されるポリシーの全体を JSON 形式で示します。
以下の JSON 内で <AWS_ACCOUNT_ID> と記載されている箇所は、お客様の管理アカウントの AWS アカウント ID に置き換えてください。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListStackSetsGlobally",
"Effect": "Allow",
"Action": [
"cloudformation:ListStackSets",
"cloudformation:ListStackInstances",
"cloudformation:DescribeStackSetOperation",
"cloudformation:GetTemplateSummary",
"cloudformation:GetTemplate"
],
"Resource": "*"
},
{
"Sid": "DescribeOrganizationsStacks",
"Effect": "Allow",
"Action": [
"cloudformation:DescribeStackSet",
"cloudformation:DescribeStackInstance",
"cloudformation:DescribeStacks",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStackResources"
],
"Resource": [
"arn:aws:cloudformation:*:<AWS_ACCOUNT_ID>:stackset/CloudAutomator-Organizations-StackSet:*",
"arn:aws:cloudformation:*:<AWS_ACCOUNT_ID>:stack/CloudAutomator-Organizations-StackSet/*",
"arn:aws:cloudformation:*:<AWS_ACCOUNT_ID>:stack/CloudAutomator-Organizations-Management-Role/*"
]
},
{
"Sid": "UpdateOrganizationsStackSet",
"Effect": "Allow",
"Action": [
"cloudformation:UpdateStackSet",
"cloudformation:UpdateStackInstances",
"cloudformation:CreateStackInstances",
"cloudformation:DeleteStackInstances"
],
"Resource": [
"arn:aws:cloudformation:*:<AWS_ACCOUNT_ID>:stackset/CloudAutomator-Organizations-StackSet:*",
"arn:aws:cloudformation:*:<AWS_ACCOUNT_ID>:stackset-target/CloudAutomator-Organizations-StackSet:*/*",
"arn:aws:cloudformation:*::type/resource/*"
]
},
{
"Sid": "UpdateOrganizationsStackInstances",
"Effect": "Allow",
"Action": [
"cloudformation:UpdateStack"
],
"Resource": "arn:aws:cloudformation:*:<AWS_ACCOUNT_ID>:stack/CloudAutomator-Organizations-StackSet/*"
},
{
"Sid": "DescribeOrganizationsStructure",
"Effect": "Allow",
"Action": [
"organizations:ListChildren",
"organizations:ListAccounts",
"organizations:ListAccountsForParent",
"organizations:DescribeAccount",
"organizations:DescribeOrganizationalUnit",
"organizations:DescribeOrganization",
"organizations:ListOrganizationalUnitsForParent",
"organizations:ListRoots",
"organizations:ListDelegatedAdministrators"
],
"Resource": "*"
},
{
"Sid": "DescribeAvailableRegions",
"Effect": "Allow",
"Action": [
"ec2:DescribeRegions"
],
"Resource": "*"
}
]
}