Tagged: jq Toggle Comment Threads | Keyboard Shortcuts

  • penguin 12:33 on 2017-04-26 Permalink | Reply
    Tags: , jq   

    jq makes AWS “describe-instances” actually useful 

    Just so I don’t forget 🙂

    aws ec2 describe-instances | \
      jq '.Reservations[].Instances[] | {IP: .PrivateIpAddress, ID: .InstanceId, Name: .Tags[] | select(.Key=="Name").Value}'

     

     
  • penguin 16:09 on 2016-03-17 Permalink | Reply
    Tags: ansible, , jq   

    Ansible inventory file from Consul 

    Quick self-reminder:

    curl consul.domain:8500/v1/catalog/nodes | jq '.[]|.Address' | tr -d '"'
     
  • penguin 12:27 on 2015-12-11 Permalink | Reply
    Tags: jq   

    jq stuff 

    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.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel