Browse the Repo
Browse the Repo
Deploy a Consul cluster. Supports automatic bootstrapping, DNS, Consul UI, and auto healing.
This repo contains a set of modules in the modules folder for deploying a Consul cluster on AWS using Terraform. Consul is a distributed, highly-available tool that you can use for service discovery and key/value storage. A Consul cluster typically includes a small number of server nodes, which are responsible for being part of the consensus quorum, and a larger number of client nodes, which you typically run alongside your apps:
This repo has the following folder structure:
modulesfolder to deploy Consul.
To deploy Consul servers for production using this repo:
If you are just experimenting with this Module, you may find it more convenient to use one of our official public AMIs:
WARNING! Do NOT use these AMIs in your production setup. In production, you should build your own AMIs in your own AWS account.
Deploy that AMI across an Auto Scaling Group using the Terraform consul-cluster module
and execute the run-consul script with the
--server flag during boot on each
Instance in the Auto Scaling Group to form the Consul cluster. Here is an example Terraform
configuration to provision a Consul cluster.
To deploy Consul clients for production using this repo:
.consul) so that URLs such as
foo.service.consulresolve automatically to the IP address(es) for a service
fooregistered in Consul (all other domain names will be continue to resolve using the default resolver on the OS).
A Module is a canonical, reusable, best-practices definition for how to run a single piece of infrastructure, such as a database or server cluster. Each Module is created using Terraform, and includes automated tests, examples, and documentation. It is maintained both by the open source community and companies that provide commercial support.
Instead of figuring out the details of how to run a piece of infrastructure from scratch, you can reuse existing code that has been proven in production. And instead of maintaining all that infrastructure code yourself, you can leverage the work of the Module community to pick up infrastructure improvements through a version number bump.
run-consul: This module includes the scripts to configure and run Consul. It is used by the above Packer module at build-time to set configurations, and by the Terraform module at runtime with User Data to create the cluster.
install-dnsmasq module: Install Dnsmasq
for Ubuntu 16.04 and Amazon Linux 2 and configure it to forward requests for a specific domain to Consul. This allows you to use Consul as a DNS server
for URLs such as
setup-systemd-resolved module: Setup systemd-resolved
for ubuntu 18.04 and configure it to forward requests for a specific domain to Consul. This allows you to use Consul as a DNS server
for URLs such as
consul-iam-policies: Defines the IAM policies necessary for a Consul cluster.
consul-security-group-rules: Defines the security group rules used by a Consul cluster to control the traffic that is allowed to go in and out of the cluster.
consul-client-security-group-rules: Defines the security group rules used by a Consul agent to control the traffic that is allowed to go in and out.
Contributions are very welcome! Check out the Contribution Guidelines for instructions.
During initial development, the major version will be 0 (e.g.,
0.x.y), which indicates the code does not yet have a
stable API. Once we hit
1.0.0, we will make every effort to maintain a backwards compatible API and use the MAJOR,
MINOR, and PATCH versions on each release to indicate any incompatibilities.
Copyright © 2017 Gruntwork, Inc.
We're here to talk about our services, answer any questions, give advice, or just to chat.