ひとまずメモとして置いておきます。
特定のタグがついたEC2インスタンスにのみ以下の操作を許可するポリシーです。
- インスタンスの再起動
- インスタンスの開始
- インスタンスの終了
policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "xxxxxxxxxxxxxxxxx",
"Effect": "Allow",
"Action": [
"ec2:RebootInstances",
"ec2:StartInstances",
"ec2:StopInstances"
],
"Condition": {
"StringEquals": {
"ec2:ResourceTag/[:tagName]": "[:value]"
}
},
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": [
"ec2:Describe*"
],
"Resource": [
"*"
]
}
]
}
[:tagName]を指定するタグ名に、[:value]を指定する値に置き換えればOK。