Skip to content

Instantly share code, notes, and snippets.

@debo
Last active December 1, 2016 03:57
Show Gist options
  • Save debo/773f1cdcc323dec2fc94b0b23a9eb9de to your computer and use it in GitHub Desktop.
Save debo/773f1cdcc323dec2fc94b0b23a9eb9de to your computer and use it in GitHub Desktop.
Useful CLI comands to ssh into or terminate your AWS EC2 instances without AWS Console
aws ec2 describe-instances --filter Name=tag:Name,Values='[query]' --profile=[profile] --region=[region] | jq '.Reservations[].Instances[].PrivateIpAddress'| sed 's/"//g' | sed 's/null//g' | sed '/^\s*$/d' | sort
aws ec2 describe-instances --filter Name=tag:Name,Values='[query]' --profile=[profile] --region=[region] | jq '.Reservations[].Instances[].InstanceId'| sed 's/"//g' | sort
aws ec2 terminate-instances --instance-ids [instanceId] --profile=[profile] --region=[region]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment