Skip to content

Instantly share code, notes, and snippets.

Last active Feb 9, 2017
What would you like to do?
Retrieves information about an AWS instance and outputs it via stdout. Written to use as a Sensu check to get basic information about a client.
# Written By:
# This script will curl the instance metadata and output useful values
# If the system isn't in AWS it will succeed with a relevant message
instance_id=`curl --silent`
instance_type=`curl --silent`
location=`curl --silent`
region=`curl --silent | sed 's/.$//'`
if [ "$instance_id" == "" ]; then
echo "This is not an AWS instance"
exit 0
echo "Location: ${location}"
echo "Instance ID: ${instance_id}"
echo "Instance Type: ${instance_type}"
echo "Cloudwatch Link:${region}#metrics:metricFilter=Search%253D${instance_id}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment