Adding IP to Security Group

8 views
Skip to first unread message

Robert Pohl

unread,
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 203.0.113.0/24
end
end

brian...@gmail.com

unread,
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

unread,
Jan 21, 2016, 10:15:51 AM1/21/16
to rubbe...@googlegroups.com
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:
 
 
--
Kevin
--
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 rubber-ec2+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
 
Reply all
Reply to author
Forward
0 new messages