amazon-web-servicesamazon-ec2amazon-iamterraform-provider-awsamazon-policy

What are the required AWS IAM policy permissions to create security group and adding inbound/outbound rules?


I am writing an IAM Policy to deploy EC2 Instances along with creating Security Groups using Terraform, I don't want to give EC2 full access. Following principle of least privilege, what are the permissions required to create Security groups also adding inbound and outbound rules?


Solution

  • The list of IAM actions for EC2 should be a helpful reference.

    The action for creating a security group is CreateSecurityGroup. Note: that action alone will not suffice if you need to create ingress and egress rules on the security group. For those, you will need to add AuthorizeSecurityGroupIngress and AuthorizeSecurityGroupEgress.