Adding IP to Security Group

Skip to first unread message

Robert Pohl

Jan 20, 2016, 4:29:21 PM1/20/16
to rubber
Hi, I'd like to add the IP for the newly created instance to some security groups, but I don't have any idea of how to get the IP for the current instance.
Any ideas if how the script should look like ?

Something like this?

after "deploy", "deploy:add_ip_to_sgs"
namespace :deploy do
task :add_ip_to_sgs do
#$ aws ec2 authorize-security-group-ingress --group-name my-sg --protocol tcp --port 8080 --cidr

Jan 20, 2016, 8:53:22 PM1/20/16
to rubber
You can get the IP address of the instance from AWS Console.

Kevin Menard

Jan 21, 2016, 10:15:51 AM1/21/16
Hi Robert,
Can you better describe what it is you're trying to do? Rubber already has a built-in mechanism for managing security groups, so you shouldn't need to add a new task for this. But to answer your immediate question, you can get the IP by looking up the InstanceItem. We do this all over the Rubber codebase, so feel free to grep for examples.
Here's one taken from the DNS template, searching by role name:
Here's another taken from the PostgreSQL template, searching by host name:
You received this message because you are subscribed to the Google Groups "rubber" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit
Reply all
Reply to author
0 new messages