Difference between revisions of "Cannot iterate over null"

From wikieduonline
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
  [[jq]]: error (at <stdin>:1904): Cannot iterate over null (null)
+
 
 +
  [[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'
  
  

Latest revision as of 11:10, 30 June 2022

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: