Skip to content

Instantly share code, notes, and snippets.

@krishnan-mani
Created February 22, 2018 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krishnan-mani/ee599fdb068112a9d33bbaff756c0461 to your computer and use it in GitHub Desktop.
Save krishnan-mani/ee599fdb068112a9d33bbaff756c0461 to your computer and use it in GitHub Desktop.
Describe EC2 instances by filtering on tag values, then stop a list of instances by instance-id
$ aws ec2 describe-instances \
--filters "Name=tag:Name,Values=CodeDeployDemo" \
--query "Reservations[*].Instances[*].InstanceId" \
--output text
$ aws ec2 stop-instances --instance-ids i-abc17charsid01 i-def17charsid02 i-pqr17charsid-03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment