EC2 + Consul + Curl always resolving EC2s in the same AZ

Good morning, everyone.
We use a combination of EC2 + Consul as SD nodes in auto-scaling groups.

EC2 instances for services are correctly registered and dig shows multiple nodes across multiple AZs being registered, however, when using curl with local (where the Consul agent runs in each instance) only those instances within the same AZ are resolved and therefore used as a target.

Are you aware of anything that might make this happen and how to avoid it?

Thanks in advance

You have not included the particulars of the Consul API being involved, or how your AZs map to Consul DCs, so it is difficult to say for certain, but it sounds like Consul is functioning as designed and returning closer service instances where available.

Thanks a lot for your reply.
Our Consul setup is quite straight forward, Consul servers are spread over 3 AZs. ASGs are also spawning instances over 3 AZs. Each Instance is explicitly registered (no ASG SD being used).

However, what you mention about functioning as designed returning closer services is a feature we obviously failed to read about.
Are you aware of a way to “disable” this and simply resolve in random fashion any of the nodes?

Again, thanks again for your time.

The answer greatly depends on

so please provide that info

We only have one DC with all 3 AZs.
So, as for Consul, all instances should be equal, although they might respond with different latencies, indeed.

Thanks @maxb