running aws ec2 describe-instances will return a json text similar to the following:
{
"Reservations": [
{
"Instances": [
"PublicDnsName": "ec2..."
"VpcId": "vpc-...",
...
"Instances": [
I know for each "Instance" I can extract the contents of a single field, for example PublicDnsName, using jq as follows:
jq '.Reservations[].Instances[].PublicDnsName'
which will list the dns names for my instances
But how do I extract two or more fields and separate them by a space or comma or something? I want PublicDnsName and VpcId to be listed side-by-side for each Instance.
Specifically what I'm looking for is a list of instances where VpcId is null, undefined, or non-existent. In other words I'd like a list of my Classic instances and I need this through api so I can process the results.