Created
February 26, 2010 22:31
-
-
Save oldpatricka/316256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#script to get central manager from EC2 metadata server | |
USER_DATA=`curl -s http://169.254.169.254/2009-04-04/user-data` | |
SPLIT_DATA=`echo $USER_DATA | awk -F"," '{print $1}'` | |
for item in ${SPLIT_DATA}; do | |
key=`echo $item | sed s/=.*//` | |
value=`echo $item | sed s/.*=//` | |
if [ $key == "central_manager" ]; then | |
CENTRAL_MANAGER=$value | |
fi | |
done | |
AVAILABILITY_ZONE=`curl -s http://instance-data.ec2.internal/latest/meta-data/placement/availability-zone` | |
PUBLIC_IP=`curl -s http://instance-data.ec2.internal/latest/meta-data/public-ipv4` | |
PRIVATE_IP=`curl -s http://instance-data.ec2.internal/latest/meta-data/local-ipv4` | |
PUBLIC_HOSTNAME=`curl -s http://instance-data.ec2.internal/latest/meta-data/public-hostname` | |
echo Setting Hostname to $PUBLIC_HOSTNAME 1>&2 | |
hostname $PUBLIC_HOSTNAME | |
echo COLLECTOR_HOST = $CENTRAL_MANAGER | |
echo PRIVATE_NETWORK_NAME = amazon-ec2-$AVAILABILITY_ZONE | |
echo TCP_FORWARDING_HOST = $PUBLIC_IP | |
echo PRIVATE_NETWORKING_INTERFACE = $PRIVATE_IP | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment