Mastodon Mastodon - jq stuff
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. jq stuff

jq stuff

Posted on December 11, 2015  (Last modified on March 9, 2022) • 1 min read • 60 words
Tools: Jq   Tools   Cli  
Tools: Jq   Tools   Cli  
Share via

Waah. In case I *ever* need this again.

aws ec2 describe-security-groups | \
    jq '.SecurityGroups | \
        map(select(has("Tags"))) | \
        map(select(.Tags[].Key|contains("Name"))) | \
        .[] | \
        [ .Tags , .GroupId ] | \
        [ (.[0]|map(select(.Key=="Name")))[0].Value, .[1] ] | \
        join("=") '

What does it do? It makes a list

$NAME_TAG=$GROUP_ID

… for each security group which has a name tag. Yeah, right.

 My essential Firefox addons
Shortcut with “ö” (o-umlaut) 
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Link copied to clipboard
Code copied to clipboard