I have a CloudFormation script which creates 2 instances - an Aurora RDS server and an EC2 instance which will use it. I need to use the Aurora's IP address in my init script for the EC2 instance so I can seed the database.
So Aurora needs to be up and running before my init script on the EC2 executes. The other thing is I need the IP address.
"UserData" : {
"Fn::Base64" : {
"Fn::Join" : [
"",
[
"<script>\n",
"seedtool.exe ", { "Ref" : "MyAuroraDbInstance::InternalIP" }, "\n",
"</script>\n"
]
]
}
},
So my question is, what do I put instead of MyAuroraDbInstance::InternalIP
in the above script?
Use Fn::GetAtt on the DBInstance and request an attribute of Endpoint.Address. This will not give an IP, it will give a CNAME