-
-
Save noahehall/1ef4117f61526b7f2e12af80b72fdb4a to your computer and use it in GitHub Desktop.
AWS Cookbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a (filtered) list of AWS instances, comma separated: | |
# | |
# Here's the reference to the 'describe-instances' command in aws-cli, | |
# check out the filters section. | |
# http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html | |
$ aws ec2 describe-instances --filters "Name=availability-zone,Values=us*" | \ | |
jq -r '.Reservations[] | .Instances[] | "\(.InstanceId)"' | \ | |
tr '\n' ',' | |
# Example: Create tags on these instances: | |
$ aws ec2 create-tags --resources `aws ec2 describe-instances --filters "Name=availability-zone,Values=us*" | jq -r '.Reservations[] | .Instances[] | "\(.InstanceId)"' | tr '\n' ' '` --tags "Key=Env,Value=Production" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment