These are chat archives for aws/aws-cli

Jan 2017
Nam Nguyen
Jan 20 2017 19:41
hi, I’m trying to list subnets and sort by Tag Name but some does not have this tag which cause my cli fail, this is my query
aws ec2 describe-subnets --output 'table' --query 'sort_by(Subnets[*].{ "CIDR": CidrBlock, "ID": SubnetId, "IP": AvailableIpAddressCount, "NAME": Tags[?Key==`Name`].Value|[0], "PUBLIC IP": MapPublicIpOnLaunch, "ZONE": AvailabilityZone }, &NAME)
Error is: In function sort_by(), invalid type for value: {u'NAME': None, u'ZONE': 'us-east-1c', u'IP': 4091, u'PUBLIC IP': True, u'CIDR': '', u'ID': 'subnet-e388d6cb'}, expected one of: ['string', 'number'], received: “null"
so does anyone know how to handle the case of null value for sort_by ?
Nam Nguyen
Jan 20 2017 19:51
Never mind, I figured it out, use to_string(NAME) to resolve the error