Issue link: https://read.uberflip.com/i/1334488
Chapter 2 35 Creation of security groups Recall that we have already created a default security group that opened up TCP port 22 from anywhere and allowed us to ping our instances. We have also added in a new group to allow us to access our Windows environment. To open up another port, we simply run our command again, assigning that port to a particular group. For example, to open up TCP port 80 and port 443 on our instances using euca2ools, we can do the following: euca-add-group webserver -d "Web Server Access" euca-authorize webserver -P tcp -p 80 -s 0.0.0.0/0 euca-authorize webserver -P tcp -p 443 -s 0.0.0.0/0 And to open up TCP port 80 and port 443 on our instances using Nova Client we can do the following: nova secgroup-create webserver "Web Server Access" nova secgroup-add-rule webserver tcp 80 80 0.0.0.0/0 nova secgroup-add-rule webserver tcp 443 443 0.0.0.0/0 Note that we specified a different group, this time named webserver. The reason for this is that we might not want to open up our web server to everyone, by default, which would happen every time we spin up a new instance. Putting it into its own security group allows us to open up access to our instance to port 80 by simply specifying this security group when we launch an instance. For example, when using euca2ools, we use the -g option. euca-run-instances ami-00000002 -k openstack -t m1.tiny -g default -g webserver Under Nova Client, we specify the --security_groups option nova boot myInstance --image 0e2f43a8-e614-48ff-92bd-be0c68da19f4 --flavor 2 --key_name openstack --security_groups default,webserver To remove a rule from a security group To remove a rule from a security group, we run the euca-revoke or nova secgroup- delete commands. For example, suppose we want to remove the HTTPS rule from our webserver group. To do this using euca2ools, we do the following: euca-revoke webserver -P tcp -p 443 -s 0.0.0.0/0 Under Nova Client this would be: nova secgroup-delete-rule webserver tcp 443 443 0.0.0.0/0 www.it-ebooks.info

