Whitelist an IP in Amazon AWS security group from command line

Written by

To white list an IP in Amazon AWS security group using aws command line tool, run

aws ec2 authorize-security-group-ingress --group-id SECURITY_GROUP_ID_HERE --protocol tcp --port PORT_HERE --cidr IP_IN_CIDR_HERE

Example

aws ec2 authorize-security-group-ingress --group-id sg-a777eee6  --protocol tcp --port 443 --cidr 94.31.33.128/27