This is my JSON output from awscli I want to get xxxxxxxx.cloudfront.net using Origin DomainName example1.com with AWS cli query only. { I know this filtering with jq, awk and cut, grep }.
"DistributionList": {
"Items": [
{
"WebACLId": "",
"Origins": {
"Items": [
{
"OriginPath": "",
"CustomOriginConfig": {
"OriginProtocolPolicy": "http-only",
"HTTPPort": 80,
"HTTPSPort": 443
},
"Id": "DNS for Media Delivery",
"DomainName": "example1.com"
}
],
"Quantity": 1
},
"DomainName": "xxxxxxxx.cloudfront.net",
},
{
"WebACLId": "",
"Origins": {
"Items": [
{
"OriginPath": "",
"CustomOriginConfig": {
"OriginProtocolPolicy": "http-only",
"HTTPPort": 80,
"HTTPSPort": 443
},
"Id": "DNS for Media Delivery",
"DomainName": "example2.com"
}
],
"Quantity": 1
},
"DomainName": "yyyyyyyyyy.cloudfront.net",
},
]
}
As AWS CLI
--query
parameter works on top of JMESPath you can build awesome filters. Answer for your question will be:and it will return you:
P.S. Hope it will help someone.