How to connect instances in CloudFormation
I do this now to add new nodes to my puppet master. For example, I grab the private IP of the puppet master instance in the UserData section of my new node:
"echo ", { "Fn::GetAtt" : [ "MasterOfPuppets", "PrivateIp" ] }, " ",
{ "Fn::GetAtt" : [ "MasterOfPuppets", "PrivateDnsName" ] } ," puppet
>> /etc/hosts\n","\n",
See page 119 of the CloudFormation User guide.
Alternatively you could use the instance MetaData:
curl http://169.254.169.254/latest/meta-data/local-ipv4/