Discussion:
Unable to create an AWS instance in particular security group.
Pradeep Chhetri
2014-04-06 12:24:00 UTC
Permalink
Hello,

I am trying to create an instance in AWS in a particular security group.

server = conn.servers.create(:image_id => "#{@ami_id}",
:flavor_id =>
"#{@instancetype}",
:key_name =>
"#{@aws_ssh_key_name}",
:groups => "Monitoring",
:subnet_id =>
"#{@subnetid.shuffle.first}",
:user_data => "#{user_data}")

where Monitoring is the name of the security group.

But when the machine comes up. It takes the "default" security group. I
tried replacing "Monitoring" with the security-group-id but still I wasn't
able to get Monitoring security group in the new instance. Can someone
please help me out.


Thank you,

- Pradeep
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Pradeep Chhetri
2014-04-07 06:55:38 UTC
Permalink
Finally figured out that I should use :security_group_ids =>
["sg-xxxxxxx"].
Post by Pradeep Chhetri
Hello,
I am trying to create an instance in AWS in a particular security group.
:flavor_id =>
:key_name =>
:groups => "Monitoring",
:subnet_id =>
:user_data => "#{user_data}")
where Monitoring is the name of the security group.
But when the machine comes up. It takes the "default" security group. I
tried replacing "Monitoring" with the security-group-id but still I wasn't
able to get Monitoring security group in the new instance. Can someone
please help me out.
Thank you,
- Pradeep
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Frederick Cheung
2014-04-07 08:48:30 UTC
Permalink
You definitely can use the group names, but it needs to be an array - :groups => ['Monitoring'], even if there's only the one group.

Fred 
Post by Pradeep Chhetri
Finally figured out that I should use :security_group_ids =>
["sg-xxxxxxx"].
Post by Pradeep Chhetri
Hello,
I am trying to create an instance in AWS in a particular security group.
:flavor_id =>
:key_name =>
:groups => "Monitoring",
:subnet_id =>
:user_data => "#{user_data}")
where Monitoring is the name of the security group.
But when the machine comes up. It takes the "default" security group. I
tried replacing "Monitoring" with the security-group-id but still I wasn't
able to get Monitoring security group in the new instance. Can someone
please help me out.
Thank you,
- Pradeep
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Pradeep
2014-04-07 08:53:20 UTC
Permalink
Hi Fred,

As you said, I tried passing as an array as well. It didn't work. It
took the "default" Security group only. The machine is inside VPC.
Should it make any difference ? Do I need to mentioned vpc-id anywhere ?
Post by Frederick Cheung
You definitely can use the group names, but it needs to be an array - :groups => ['Monitoring'], even if there's only the one group.
Fred
Post by Pradeep Chhetri
Finally figured out that I should use :security_group_ids =>
["sg-xxxxxxx"].
Post by Pradeep Chhetri
Hello,
I am trying to create an instance in AWS in a particular security group.
:flavor_id =>
:key_name =>
:groups => "Monitoring",
:subnet_id =>
:user_data => "#{user_data}")
where Monitoring is the name of the security group.
But when the machine comes up. It takes the "default" security group. I
tried replacing "Monitoring" with the security-group-id but still I wasn't
able to get Monitoring security group in the new instance. Can someone
please help me out.
Thank you,
- Pradeep
--
You received this message because you are subscribed to the Google Groups "ruby-fog"
group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Frederick Cheung
2014-04-07 09:31:10 UTC
Permalink
Ah, may well change things - I've never used that before. Security groups are different with a vpc so it wouldn't surprise me if there was a difference 

Fred
Post by Pradeep
Hi Fred,
As you said, I tried passing as an array as well. It didn't work. It
took the "default" Security group only. The machine is inside VPC.
Should it make any difference ? Do I need to mentioned vpc-id anywhere ?
Post by Frederick Cheung
You definitely can use the group names, but it needs to be an array - :groups => ['Monitoring'],
even if there's only the one group.
Post by Frederick Cheung
Fred
Post by Pradeep Chhetri
Finally figured out that I should use :security_group_ids =>
["sg-xxxxxxx"].
Post by Pradeep Chhetri
Hello,
I am trying to create an instance in AWS in a particular security group.
:flavor_id =>
:key_name =>
:groups => "Monitoring",
:subnet_id =>
:user_data => "#{user_data}")
where Monitoring is the name of the security group.
But when the machine comes up. It takes the "default" security group. I
tried replacing "Monitoring" with the security-group-id but still I wasn't
able to get Monitoring security group in the new instance. Can someone
please help me out.
Thank you,
- Pradeep
--
You received this message because you are subscribed to the Google Groups "ruby-fog"
group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Pradeep
2014-04-07 09:35:47 UTC
Permalink
For now, security_group_ids is working for me nicely. Thank you Fred.

-Pradeep
Post by Frederick Cheung
Ah, may well change things - I've never used that before. Security groups are different with a vpc so it wouldn't surprise me if there was a difference
Fred
Post by Pradeep
Hi Fred,
As you said, I tried passing as an array as well. It didn't work. It
took the "default" Security group only. The machine is inside VPC.
Should it make any difference ? Do I need to mentioned vpc-id anywhere ?
Post by Frederick Cheung
You definitely can use the group names, but it needs to be an array - :groups => ['Monitoring'],
even if there's only the one group.
Post by Frederick Cheung
Fred
Post by Pradeep Chhetri
Finally figured out that I should use :security_group_ids =>
["sg-xxxxxxx"].
Post by Pradeep Chhetri
Hello,
I am trying to create an instance in AWS in a particular security group.
:flavor_id =>
:key_name =>
:groups => "Monitoring",
:subnet_id =>
:user_data => "#{user_data}")
where Monitoring is the name of the security group.
But when the machine comes up. It takes the "default" security group. I
tried replacing "Monitoring" with the security-group-id but still I wasn't
able to get Monitoring security group in the new instance. Can someone
please help me out.
Thank you,
- Pradeep
--
You received this message because you are subscribed to the Google Groups "ruby-fog"
group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog"
group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Pradeep
2014-04-07 11:35:43 UTC
Permalink
Thanks Suresh.
Hi Pradeep,
Below is the code which is working fine for me .
instance = compute.servers.create ({
:flavor_id => opts[:flavor],
:key_name => opts[:key],
:image_id => opts[:ami],
:security_group_ids => opts[:security_group],
:subnet_id => opts[:subnet_id],
:tags => {"Name" => opts[:name]}
})
So you should use security_group_ids in your code. Those are unique
and different for VPC and EC2 classic .
For now, security_group_ids is working for me nicely. Thank you Fred.
-Pradeep
Ah, may well change things - I've never used that before.
Security groups are different with a vpc so it wouldn't
surprise me if there was a difference
Fred
On 7 April 2014 at 09:53:27, Pradeep
Hi Fred,
As you said, I tried passing as an array as well. It
didn't work. It
took the "default" Security group only. The machine is inside VPC.
Should it make any difference ? Do I need to mentioned
vpc-id anywhere ?
You definitely can use the group names, but it needs
to be an array - :groups => ['Monitoring'],
even if there's only the one group.
Fred
On 7 April 2014 at 07:55:40, Pradeep Chhetri
Finally figured out that I should use
:security_group_ids =>
["sg-xxxxxxx"].
On Sunday, 6 April 2014 17:54:00 UTC+5:30, Pradeep
Hello,
I am trying to create an instance in AWS in a
particular security group.
server = conn.servers.create(:image_id =>
:flavor_id =>
:key_name =>
:groups => "Monitoring",
:subnet_id =>
:user_data => "#{user_data}")
where Monitoring is the name of the security
group.
But when the machine comes up. It takes the
"default" security group. I
tried replacing "Monitoring" with the
security-group-id but still I wasn't
able to get Monitoring security group in the
new instance. Can someone
please help me out.
Thank you,
- Pradeep
--
You received this message because you are
subscribed to the Google Groups "ruby-fog"
group.
To unsubscribe from this group and stop receiving
emails from it, send an email to
For more options, visit
https://groups.google.com/d/__optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to
the Google Groups "ruby-fog"
group.
To unsubscribe from this group and stop receiving emails
from it, send an email to
For more options, visit
https://groups.google.com/d/__optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/__optout
<https://groups.google.com/d/optout>.
--
Best Regards,
Suresh Prajapati
Mob No: +91-9000173245
----------------------------------------------------------------------------------------
Theory is when you know all and nothing works. Practice is when all
works and nobody knows why. In this case we have put together theory
and practice: nothing works... and nobody knows why!
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Suresh Prajapati
2014-04-07 11:08:16 UTC
Permalink
Hi Pradeep,

Below is the code which is working fine for me .

instance = compute.servers.create ({
:flavor_id => opts[:flavor],
:key_name => opts[:key],
:image_id => opts[:ami],
:security_group_ids => opts[:security_group],
:subnet_id => opts[:subnet_id],
:tags => {"Name" => opts[:name]}
})

So you should use security_group_ids in your code. Those are unique and
different for VPC and EC2 classic .
Post by Pradeep
For now, security_group_ids is working for me nicely. Thank you Fred.
-Pradeep
Post by Frederick Cheung
Ah, may well change things - I've never used that before. Security groups
are different with a vpc so it wouldn't surprise me if there was a
difference
Fred
Post by Pradeep
Hi Fred,
As you said, I tried passing as an array as well. It didn't work. It
took the "default" Security group only. The machine is inside VPC.
Should it make any difference ? Do I need to mentioned vpc-id anywhere ?
Post by Frederick Cheung
You definitely can use the group names, but it needs to be an array -
:groups => ['Monitoring'],
even if there's only the one group.
Post by Frederick Cheung
Fred
On 7 April 2014 at 07:55:40, Pradeep Chhetri (
Post by Pradeep Chhetri
Finally figured out that I should use :security_group_ids =>
["sg-xxxxxxx"].
Post by Pradeep Chhetri
Hello,
I am trying to create an instance in AWS in a particular security group.
:flavor_id =>
:key_name =>
:groups => "Monitoring",
:subnet_id =>
:user_data => "#{user_data}")
where Monitoring is the name of the security group.
But when the machine comes up. It takes the "default" security group. I
tried replacing "Monitoring" with the security-group-id but still I wasn't
able to get Monitoring security group in the new instance. Can someone
please help me out.
Thank you,
- Pradeep
--
You received this message because you are subscribed to the Google
Groups "ruby-fog"
group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog"
group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Best Regards,
Suresh Prajapati
Mob No: +91-9000173245
----------------------------------------------------------------------------------------
Theory is when you know all and nothing works. Practice is when all works
and nobody knows why. In this case we have put together theory and
practice: nothing works... and nobody knows why!
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...