我有一些 ec2 快照,其标签为键 ce 和值 ae-12 。我想允许角色对仅包含上述标签的快照执行 ec2:CopySnapshot 操作。 我正在使用以下策略,但它不起作用:
{
"Sid": "snapshare",
"Effect": "Allow",
"Action": [
"ec2:CopySnapshot"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:ResourceTag/ce": "ae-12"
}
}
}
我还在条件块中尝试了 "aws:ResourceTag/ce": "yes" 但它也失败了。
任何人都可以帮助我如何通过 IAM 政策解决这个问题吗?
根据文档,
CopySnapshot
可用的条件键有:
aws:RequestTag/${TagKey}
aws:TagKeys
ec2:OutpostArn
ec2:SnapshotID
所以你可以尝试:
{
"Sid": "snapshare",
"Effect": "Allow",
"Action": [
"ec2:CopySnapshot"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestTag/ce": "ae-12"
}
}
}