I\'m launching an EC2 instance, by invoking ec2-run-instances from simple a bash script, and want to perform further operations on that instance (e.g. associate elastic IP)
http://www.tothenew.com/blog/how-to-parse-json-by-command-line-in-linux/
best tool to parse json in shell
#get instance id
cat sample.json | jq '.Instances[0].InstanceId'|sed -e 's/^"//' -e 's/"$//'
#check instances is running or not
cat status.json | jq '.InstanceStatuses[0].InstanceState.Name'|sed -e 's/^"//' -e 's/"$//'