Reputation: 949
I am trying to create a security group using boto ec2 connection object. Security group is getting created successfully but it is creating in ec2, but I would like create it in the VPC. Below is the code snippet
import boto
import boto.ec2
from sys import argv
connection = boto.ec2.connect_to_region('us-east-1')
create = connection.create_security_group('test', 'Testing')
Upvotes: 2
Views: 1434
Reputation: 61
From the boto doc for vpc you can tell that, although you are creating a boto.vpc.VPCConnection object, you are still creating connections to ec2, and there is actually no difference between these two methods for creating security groups.
Upvotes: 0
Reputation: 949
I got the answer, I should be using boto.vpc instead of boto.ec2. See the below code used to create a security group in VPC.
import boto
import boto.vpc
from sys import argv
connection = boto.vpc.connect_to_region('us-east-1')
create = connection.create_security_group('testing1', 'testing1', vpc_id='vpc-1234abc56')
print create, create.id, create.name
Upvotes: 1