I would like to get names of all the aws load balancers which has a particular instance.
I can list the instances in the ELB's using the following command
aws elb describe-load-balancers --query "LoadBalancerDescriptions[*].{ID:LoadBalancerName,InstanceId:Instances[*].InstanceId}[*]. {ELB:ID,InstanceId:InstanceId[*]}" --output=json
Sample Output:
[
{
"ELB": "my_name",
"InstanceId": [
"instance-id-A",
"instance-id-B",
]
},
{
"ELB": "my_name2",
"InstanceId": [
"instance-id-B",
"instance-id-C"
]
},
{
"ELB": "my_name3",
"InstanceId": [
"instance-id-A",
"instance-id-C"
]
}
]
How do I filter this output to only return the ELB names which has instance id A?