Reputation: 19342
I am describing a AWS security group and passing the output by jq
in order to get all the CIDRs of the inbound rules.
I have reached so far:
▶ aws ec2 describe-security-groups --group-ids sg-123456789 | jq '.SecurityGroups[0].IpPermissions[0].IpRanges'
[
{
"CidrIp": "11.22.33.44/32",
"Description": "Something"
},
{
"CidrIp": "22.33.44.12/32",
"Description": "Something else"
},
{
"CidrIp": "22.11.33.55/32",
"Description": "Something different"
},
]
I know I can grep
but is there a way to get just the CidrIp
from each json
element of this array?
Upvotes: 1
Views: 38
Reputation: 19342
jq '.SecurityGroups[0].IpPermissions[0].IpRanges | values[].CidrIp'
this seemed to work as well.
Upvotes: 0