How you will find out the instance id from within an ec2 machine?
wget -q -O - http://instance-data/latest/meta-data/instance-id
If you need programatic access to the instance ID from within a script
die() { status=$1; shift; echo "FATAL: $*"; exit $status; }
EC2_INSTANCE_ID="`wget -q -O - http://instance-data/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`"
If you need programatic access to the instance ID from within a script
die() { status=$1; shift; echo "FATAL: $*"; exit $status; }
EC2_INSTANCE_ID="`wget -q -O - http://instance-data/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`"
Comments