Cannot iterate over null

From wikieduonline
Jump to navigation Jump to search
jq: error (at <stdin>:1904): Cannot iterate over null (null)

aws ec2 describe-instances --query 'Reservations[*].Instances[?not_null(PublicIpAddress)]' | jq -r '.[][]|.PublicIpAddress+" "+(.Tags[]|select(.Key=="Name").Value)'

Remove Tags filter to avoid list of IPs to be truncated and get full list:
aws ec2 describe-instances --query 'Reservations[*].Instances[?not_null(PublicIpAddress)]' | jq -r '.[][].PublicIpAddress'


See also[edit]

Advertising: