Connect an edge NATS server to a central cluster as a leafnode for an IoT message backbone

domain: docs.nats.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. On the hub/central server, add a leafnodes { port: 7422 } block, the default leafnode listener port
  2. On the edge server, add a leafnodes { remotes: [ { url: "nats-leaf://hub-host:7422" } ] } block pointing at the hub
  3. Bind the leafnode connection to a specific account on both sides for multi-tenant isolation, ensuring that account already exists on the hub
  4. Add authentication via a credentials file (JWT/NKey) or username/password, and configure a tls block with verify: true on both sides for mutual TLS
  5. Start both servers and confirm the leafnode connection in the logs or via the $SYS account
  6. Publish/subscribe across the leaf and hub to validate hub-and-spoke message routing

Known gotchas

Related routes

Deploy a custom component to an edge device using AWS IoT Greengrass v2
aws.amazon.com · 6 steps · unrated
Route Azure IoT Hub device-to-cloud messages to custom endpoints using message routing queries
learn.microsoft.com · 6 steps · unrated
Synchronize configuration for an Azure IoT Edge module using its module twin instead of the parent device twin
learn.microsoft.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans