Amazon EC2:允许以编程方式和在控制台中启动或停止 EC2 实例并修改安全组 - AWS Identity and Access Management

Amazon EC2:允许以编程方式和在控制台中启动或停止 EC2 实例并修改安全组

此示例说明如何创建 IAM 策略以允许启动或停止特定的 EC2 实例并修改特定的安全组。此策略定义了程序访问和控制台访问的权限。要使用此策略,请将示例策略中的斜体占位符文本替换为您自己的信息。然后,按照创建策略编辑策略中的说明操作。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:DescribeSecurityGroups", "ec2:DescribeSecurityGroupRules", "ec2:DescribeTags" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ec2:AuthorizeSecurityGroupIngress", "ec2:RevokeSecurityGroupIngress", "ec2:AuthorizeSecurityGroupEgress", "ec2:RevokeSecurityGroupEgress", "ec2:ModifySecurityGroupRules", "ec2:UpdateSecurityGroupRuleDescriptionsIngress", "ec2:UpdateSecurityGroupRuleDescriptionsEgress" ], "Resource": [ "arn:aws:ec2:region:111122223333:security-group/*" ], "Condition": { "ArnEquals": { "ec2:Vpc": "arn:aws:ec2:region:111122223333:vpc/vpc-11223344556677889" } } }, { "Effect": "Allow", "Action": [ "ec2:ModifySecurityGroupRules" ], "Resource": [ "arn:aws:ec2:region:111122223333:security-group-rule/*" ] } ] }