IAM,仅将策略应用于标记的实例
IAM, apply policy only to tagged instances
我需要创建一个策略 IAM 以仅停止或终止具有特定标签的实例(多个实例),我写了这个:
{
"Action": [
"ec2:StopInstances",
"ec2:TerminateInstances"
],
"Effect": "Allow",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:ResourceTag/Name": "tag1",
"ec2:ResourceTag/Name": "tag2",
"ec2:ResourceTag/Name": "tag3"
}
}
},
但是表格无效,只能写一个字符串ec2:ResourceTag/Name
。如何停止和终止具有不同标签 Name
的实例?
尝试以下操作:
"Condition": {
"StringEquals": {
"ec2:ResourceTag/Name": ["tag1","tag2","tag3"]
}
}
我需要创建一个策略 IAM 以仅停止或终止具有特定标签的实例(多个实例),我写了这个:
{
"Action": [
"ec2:StopInstances",
"ec2:TerminateInstances"
],
"Effect": "Allow",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:ResourceTag/Name": "tag1",
"ec2:ResourceTag/Name": "tag2",
"ec2:ResourceTag/Name": "tag3"
}
}
},
但是表格无效,只能写一个字符串ec2:ResourceTag/Name
。如何停止和终止具有不同标签 Name
的实例?
尝试以下操作:
"Condition": {
"StringEquals": {
"ec2:ResourceTag/Name": ["tag1","tag2","tag3"]
}
}