You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@libcloud.apache.org by Łukasz Budnik <lu...@gmail.com> on 2013/09/16 11:35:36 UTC

EC2 VPC and existing security group problem

Hi guys,

I saw a thread about Amazon VPC. Markos Gogoulos was able to spin up new
instances but in a slightly different way.

I'm trying to spin up a new instance with an existing security group.

when I execute:

ec2-describe-group --region=us-east-1 SG_NAME

I get an error that VPC security groups can be referenced only by the ID.
When I change it to sg-ID then the command is successful and prints out all
the rules.

But when creating node using libcloud no matter if I pass the SG name or
the id. I keep getting the same error:

Exception: InvalidGroup.NotFound: The security group XXXX does not exist

Does anybody successfully created a node in EC2 VPC with an existing
security group?

thanks,
Łukasz

Re: EC2 VPC and existing security group problem

Posted by Łukasz Budnik <lu...@gmail.com>.
Hi Στις,

I modified the API_VERSION.

My code looks more or less like this:

keyname = 'XXX'
securitygroup = 'YYY
imageId = 'ZZZ'
size = 'm1.large'

image = NodeImage(id=imageId, name='', driver='')
size = NodeSize(id=size, name='', ram=None, disk=None, bandwidth=None,
price=None, driver='')
name = 'Worker - Auto Scaling - {0}'.format(now)

locations = conn.list_locations()
location = choice(locations)

node = conn.create_node(name = name, image = image, size = size, location =
location, ex_keyname = keyname, ex_securitygroup = securitygroup)

I'm getting a new exception now:

Exception: InvalidParameterCombination: VPC security groups may not be used
for a non-VPC launch.

I get the same exception when trying to launch a node using deploy_node
method.

Any hints most welcomed :)

thanks,
Łukasz


On 16 September 2013 20:03, Markos Gogoulos <mg...@mist.io> wrote:

>
>
> Hi,
>
> by modifying the API_VERSION to '2013-02-01' on the ec2 driver
> (libcloud/compute/drivers/ec2.py) we have deployed nodes on EC2 VPC and
> non-VPC accounts, by providing the security group name
>
> #create
> security group
>
> conn.ex_create_security_group(name=name,
> description=description)
>
> #grant
> permissions
> conn.ex_authorize_security_group_permissive(name=name)
>
> then
> deploy_node
>
> node = conn.deploy_node(name=machine_name,
>  image=image,
>
> size=size,
>  deploy=deploy_script,
>  location=location,
>
> ssh_key=tmp_key_path,
>  ssh_alternate_usernames=['ec2-user', 'ubuntu'],
>
> max_tries=1,
>  ex_keyname=key_id,
>
> ex_securitygroup=security_group_name)
>
> hope this helps
>
> Cheers
>
> Στις
> 16.09.2013 12:35, Łukasz Budnik έγραψε:
>
> > Hi guys,
> >
> > I saw a thread
> about Amazon VPC. Markos Gogoulos was able to spin up new
> > instances
> but in a slightly different way.
> >
> > I'm trying to spin up a new
> instance with an existing security group.
> >
> > when I execute:
> >
> >
> ec2-describe-group --region=us-east-1 SG_NAME
> >
> > I get an error that
> VPC security groups can be referenced only by the ID.
> > When I change it
> to sg-ID then the command is successful and prints out all
> > the
> rules.
> >
> > But when creating node using libcloud no matter if I pass
> the SG name or
> > the id. I keep getting the same error:
> >
> > Exception:
> InvalidGroup.NotFound: The security group XXXX does not exist
> >
> > Does
> anybody successfully created a node in EC2 VPC with an existing
> >
> security group?
> >
> > thanks,
> > Łukasz
>
>
>

Re: EC2 VPC and existing security group problem

Posted by Markos Gogoulos <mg...@mist.io>.
 

Hi, 

by modifying the API_VERSION to '2013-02-01' on the ec2 driver
(libcloud/compute/drivers/ec2.py) we have deployed nodes on EC2 VPC and
non-VPC accounts, by providing the security group name 

#create
security group 

conn.ex_create_security_group(name=name,
description=description) 

#grant
permissions
conn.ex_authorize_security_group_permissive(name=name)

then
deploy_node 

node = conn.deploy_node(name=machine_name,
 image=image,

size=size,
 deploy=deploy_script,
 location=location,

ssh_key=tmp_key_path,
 ssh_alternate_usernames=['ec2-user', 'ubuntu'],

max_tries=1,
 ex_keyname=key_id,

ex_securitygroup=security_group_name)

hope this helps 

Cheers 

Στις
16.09.2013 12:35, Łukasz Budnik έγραψε: 

> Hi guys,
> 
> I saw a thread
about Amazon VPC. Markos Gogoulos was able to spin up new
> instances
but in a slightly different way.
> 
> I'm trying to spin up a new
instance with an existing security group.
> 
> when I execute:
> 
>
ec2-describe-group --region=us-east-1 SG_NAME
> 
> I get an error that
VPC security groups can be referenced only by the ID.
> When I change it
to sg-ID then the command is successful and prints out all
> the
rules.
> 
> But when creating node using libcloud no matter if I pass
the SG name or
> the id. I keep getting the same error:
> 
> Exception:
InvalidGroup.NotFound: The security group XXXX does not exist
> 
> Does
anybody successfully created a node in EC2 VPC with an existing
>
security group?
> 
> thanks,
> Łukasz