标记资源的AWS CDK策略条件

问题描述 投票:0回答:1

我当前正在使用CDK创建一个AWS堆栈。我为部署堆栈的用户定义了一个策略,使其具有正确的权限。在CDK中,我用以下代码标记资源:

const app = new cdk.App();
const scheme = new MyTemplateStack(app, 'MyTemplateStack');


cdk.Tag.add(scheme, 'Team', 'myTeamName');

我想使用条件策略来允许我的用户拥有仅修改或删除带有正确团队标记的资源的权限:

所以这是我需要在以下条件下部署堆栈的策略示例:

        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "ec2:RevokeSecurityGroupIngress",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "ec2:ResourceTag/Team": "myTeamName"
                }
            }
        }

但是当我尝试再次部署堆栈时,出现以下错误,表明我没有被授权:

API: ec2:RevokeSecurityGroupEgress You are not authorized to perform this operation

我已经阅读过文档,但是我不明白为什么这不起作用。

感谢您的帮助!

amazon-web-services amazon-cloudformation amazon-iam aws-cdk
1个回答
0
投票

在我看来,您允许ec2:RevokeSecurityGroupIngress,但是尝试调用ec2:RevokeSecurityGroupEgress操作。您可以验证并确认吗?

© www.soinside.com 2019 - 2024. All rights reserved.