Skip to content

Instantly share code, notes, and snippets.

@estahn
Last active December 24, 2015 23:29
Show Gist options
  • Select an option

  • Save estahn/6880172 to your computer and use it in GitHub Desktop.

Select an option

Save estahn/6880172 to your computer and use it in GitHub Desktop.
Identify Amazon EC2 instance id by hostname - http://blog.enricostahn.com/identify-amazon-ec2-instance-id-by-hostname
aws ec2 describe-instances \
--filters Name=dns-name,Values=ec2-12-345-678-90.myregion.compute.amazonaws.com \
| jq '.Reservations [] .Instances [] .InstanceId' \
| xargs -n1 aws ec2 get-console-output --instance-id \
| jq '.Output'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment