Difference between revisions of "AWS/CLI"
From Christoph's Personal Wiki
(Created page with "This article will contain a (random) collection of '''Amazon Web Services - Command Line Interface''' ('''AWS CLI''') tips-and-tricks. It will also have examples using <code>b...") |
(No difference)
|
Revision as of 22:32, 26 February 2021
This article will contain a (random) collection of Amazon Web Services - Command Line Interface (AWS CLI) tips-and-tricks. It will also have examples using boto
and other miscellaneous tips-and-tricks.
- Find all AWS resources that do not have a tag with a key of "
project
" assigned to them:
$ aws resourcegroupstaggingapi get-resources --tags-per-page 100 --output json |\ jq '.ResourceTagMappingList[] | select(contains({Tags: [{Key: "project"} ]}) | not)' { "ResourceARN": "arn:aws:ec2:us-west-2:0000000:security-group/sg-1aaaaaaa", "Tags": [ { "Value": "xtof-aws-dev-sg", "Key": "Name" } ] }
- If you have AWS Config setup, you can do advanced SQL-like queries:
SELECT resourceId, resourceType, configuration.instanceType, configuration.placement.tenancy, configuration.imageId, tags, availabilityZone WHERE resourceType = 'AWS::EC2::Instance' AND tags.key NOT LIKE 'owner'