Menu
AWS Identity and Access Management
User Guide

Amazon EC2: Allows Managing EC2 Security Groups Associated With a Specific VPC, Programmatically and in the Console

This example shows how you might create a policy that allows managing Amazon EC2 security groups associated with a specific virtual private cloud (VPC). This policy also provides the permissions necessary to complete this action in the console. To use this policy, replace the red text in the example policy with your own information.

Copy
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:DeleteSecurityGroup", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress" ], "Resource": "arn:aws:ec2:<REGION>:<ACCOUNTNUMBER>:security-group/*", "Condition": { "StringEquals": { "ec2:Vpc": "arn:aws:ec2:<REGION>:<ACCOUNTNUMBER>:vpc/vpc-<VPC-ID>" } } }, { "Action": [ "ec2:DescribeSecurityGroups", "ec2:DescribeSecurityGroupReferences", "ec2:DescribeStaleSecurityGroups", "ec2:DescribeVpcs" ], "Effect": "Allow", "Resource": "*" } ] }