I am trying to play with python boto and I am running the example below (below is the white paper for this). I know that there is an SG called "Pub_HDP_SG", but when I try to run my command by passing a parameter called groupnames, I get below error. I get the fact that this SG does not exist in my VPC by default, so how do I install a VPC on a specific VPC?
http://boto.readthedocs.org/en/latest/ref/ec2.html?highlight=get_all_security_groups#boto.ec2.connection.EC2Connection.get_all_security_groups
>>> import boto
>>> ec2 = boto.connect_ec2()
>>> sg = ec2.get_all_security_groups()
>>> print sg
[SecurityGroup:default, SecurityGroup:Pub_HDP_SG, SecurityGroup:RDP Rule - open everyone , SecurityGroup:us-east-open-all, SecurityGroup:wordpress-app-SG, SecurityGroup:default, SecurityGroup:AWS-AMI-SG, SecurityGroup:launch-wizard-2]
>>>
>>> sgn = "Pub_HDP_SG"
>>>
>>> sg = ec2.get_all_security_groups(groupnames=[sgn])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/boto/ec2/connection.py", line 2968, in get_all_security_groups
[('item', SecurityGroup)], verb='POST')
File "/usr/lib/python2.6/site-packages/boto/connection.py", line 1186, in get_list
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidGroup.NotFound</Code><Message>The security group 'Pub_HDP_SG' does not exist in default VPC 'vpc-b3bf61d6'</Message></Error></Errors><RequestID>c708a4cd-0bc9-4761-a5a6-556b1c68ecdb</RequestID></Response>
>>>
source
share