Skip to main content
In this guide, you’ll learn how to set up HashiCorp Vault to use Consul as its storage backend. Consul delivers a durable, highly available key–value store that scales independently, ensuring Vault’s data is stored reliably across clusters.

Why Choose Consul for Vault Storage

Consul offers robust features that enhance Vault’s resilience and scalability:
Running a dedicated Consul cluster adds maintenance overhead—setup, ACLs, upgrades, and monitoring. However, with proper automation, it operates with minimal intervention.

Cluster Topology

  • One Vault cluster ↔ One Consul cluster (no cross–data-center mixing)
  • Odd number of nodes (3 or 5) ensures reliable leader election
  • Leader nodes accept commits and replicate logs to followers

Dedicated Consul Cluster for Vault

To prevent resource contention and maintain performance, host Vault storage on a dedicated Consul cluster. Do not co-locate service discovery or mesh workloads on the same cluster.

AWS Deployment Example

The image illustrates the deployment of the Consul storage backend across three availability zones within a VPC, each containing a private subnet. It highlights a special installation of Consul using redundancy zones.
Distribute Vault and Consul nodes across multiple Availability Zones (AZs) in a VPC:
  • Vault servers deployed in each AZ for redundancy
  • Consul servers in each AZ, using enterprise Redundancy Zones
Even if an entire AZ becomes unavailable, both Consul and Vault remain operational.

Vault Nodes & Local Consul Agents

Vault servers run a local Consul agent in client mode. Each agent joins the cluster and handles all API requests, so Vault always points to localhost:
The image illustrates the deployment of a Consul storage backend with three Vault nodes, each communicating with a local Consul agent, connected to a Consul cluster.
This model removes the need to update Vault’s configuration when the Consul cluster membership changes.

Vault Configuration Example

Below is a sample HCL configuration for Vault using Consul as the storage backend:
Ensure the Consul ACL token has permissions scoped only to the vault/ path. Rotate tokens periodically to maintain security.

Consul Server Configuration Example

Place the following JSON in /etc/consul.d/server.json on each Consul server node:
Customize addresses, data directories, and ACL tokens to fit your environment.

Further Reading

Use available coupons to get started with Consul and Vault today!

Watch Video