-datacenter - This flag controls the datacenter in which the agent is running. If not provided, it defaults to "dc1". Consul has first-class support for multiple datacenters, but it relies on proper configuration. Nodes in the same datacenter should be on a single LAN.
Is this functionally the same as host in the traditional sense? If I have box1 and box2 one in say AWS US and one in AWS EU then I definitely should not put the datacenter flag for each as the same correct?
If I then join these two AWS boxes on a Vswitch giving them the same VLAN then I can give them the same datacenter correct?
What happens if I do or don’t in either case – the docs read to me as if this is a per-box basis LAN setting.
Yes, given your first example, you would want to configure the servers in each region to be in separate Consul datacenters. The Consul Architecture doc may help clarify this.
Theoretically you could put the hosts residing in a separate region within the same Consul datacenter as long as you direct L3 connectivity. In practice, you may run into network latency issues spanning continents, requiring extra configuration of the Consul servers/agents (see: Consul: Production Server Requirements). In that scenario, it would be better to configure the regions as separate Consul datacenters.
If you do not configure the datacenter value on say box2, the agent will start and implicitly be apart of the datacenter “dc1” – which may not be the correct datacenter name for the given region. For production environments, I would recommend explicitly configuring the datacenter name in the Consul configuration (on a per-server basis) in order to avoid any confusion.