Skip to content

Instantly share code, notes, and snippets.

@ukn
Last active October 27, 2016 16:00
Show Gist options
  • Select an option

  • Save ukn/0b0687c34f03254b7de331551a8c86ab to your computer and use it in GitHub Desktop.

Select an option

Save ukn/0b0687c34f03254b7de331551a8c86ab to your computer and use it in GitHub Desktop.
bash function that formats `aws ec2 describe-instances` into something readable
jq -r '.Reservations[].Instances[] | select (.State.Name != "terminated") | .InstanceId + "\t" + .PrivateIpAddress + "\t" + ( if .PublicIpAddress then .PublicIpAddress else "\t" end) + "\t" + .InstanceType + "\t" + .State.Name + "\t " + (.Tags[] | select(.Key == "Name") | .Key + ":" + .Value)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment