Revision history [back]

click to hide/show revision 1
initial version

You can extract it executing some command in the instances.

For example:

/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'

You can extract it executing some command in the instances.

For example:

/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'

An update on my previous response:

Openstack heat documentation https://wiki.openstack.org/wiki/Heat/ApplicationDeployment describe your case:

If the UserData script needs to know the private IP address of the instance, it cannot be resolved by Fn::GetAtt(instance, "PrivateIp") since it is not available when the UserData file is resolved by the Heat engine.

The solution provided is execute the command "curl -s http://169.254.169.254/latest/meta-data/local-ipv4" in the instance to extract the private ip

You can extract it executing some command in the instances.

For example:

/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'

An update on my previous response:

Openstack heat documentation https://wiki.openstack.org/wiki/Heat/ApplicationDeployment describe your case:

If the UserData script needs to know the private IP address of the instance, it cannot be resolved by Fn::GetAtt(instance, "PrivateIp") since it is not available when the UserData file is resolved by the Heat engine.

The solution provided is execute the command "curl curl -s http://169.254.169.254/latest/meta-data/local-ipv4" http://169.254.169.254/latest/meta-data/local-ipv4 in the instance to extract the private ip