Opening and closing ports on EC2 instances

Assuming that the EC2 tools have been installed like described in a previous post, opening and closing ports is done with the ec2-authorize and ec2-revoke commands respectively. These commands work on security groups rather than on instances. Recall that a set of instances belong to a security group.

Opening port 80 on EC2 instances in the ‘default’ security group.

ec2-authorize default -p 80

Close port 80 on EC2 instances in the ‘default’ security group

ec2-revoke default -p 80

See also the Amazon command reference for the EC2 API.

Comments

One response to “Opening and closing ports on EC2 instances”

  1. […] up ports 22 and 80 for the group by using the AWS management console or by using the ec2 commandline util: ec2-authorize monitoring -p 22 ec2-authorize monitoring -p […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.