Nameがtest-ec2
のinstanceidをゲットする
aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | select(.Tags[]?.Key == "Name" and .Tags[]?.Value == "test-ec2") | {"instance-id": .InstanceId, "tags":.Tags}'
{
"instance-id": "i-xxxxx",
"tags": [
{
"Key": "Name",
"Value": "test-ec2"
}
]
}