Skip to main content
In this tutorial, you’ll learn how to securely create ACL policies in a Consul cluster. We’ll walk through bootstrapping ACLs, defining policy rules, and applying them using the Consul CLI.

Prerequisites

  • A running Consul cluster with ACLs enabled
  • Access to one of the Consul server nodes
  • Your Consul bootstrap (master) token
Make sure ACLs are enabled in your consul.hcl configuration under acl { enabled = true }.

1. Bootstrap the ACL System

On your Consul server node, initialize ACLs:
Save the SecretID—this is your bootstrap token for all future ACL operations.

2. Verify Cluster Members

Confirm all nodes are healthy and online:

3. Create Your Policy Definition

  1. Create a working directory and open a new HCL file:
  2. Define the policy rules for your eCommerce front-end application:

4. Inspect Existing KV Entries

Before applying new policies, list the current KV store:

5. Attempt Policy Creation Without Token

Running the create command without a token will fail:
Always include your bootstrap token when creating or managing ACL policies.
Without it, Consul will deny your request.

6. Create the ACL Policy With Bootstrap Token

Use the -token flag and your SecretID to successfully create the policy:
You can now use the returned policy ID when creating tokens for your application.

Further Reading & References

Watch Video