Skip to content

Instantly share code, notes, and snippets.

@sebsto
Created April 28, 2015 14:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebsto/eb48357f0bb24db8b2bf to your computer and use it in GitHub Desktop.
Save sebsto/eb48357f0bb24db8b2bf to your computer and use it in GitHub Desktop.
Find all instances without a specific tag / with a specific tag
aws ec2 describe-instances --query 'Reservations[?Instances[?length(Tags[?Key==`Environment`]) == `0`]].Instances[].InstanceId'
aws ec2 describe-instances --query 'Reservations[?Instances[?Tags[?Key==`Environment`]]].Instances[].InstanceId'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment