Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconroot-example
file-type-iconREADME.md
file-type-iconuser-data-consul.sh
file-type-iconuser-data-vault.sh
file-type-iconvault-agent
file-type-iconvault-auto-unseal
file-type-iconvault-cluster-private
file-type-iconvault-consul-ami
file-type-iconvault-ec2-auth
file-type-iconvault-examples-helper
file-type-iconvault-iam-auth
file-type-iconvault-s3-backend
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconCONTRIBUTING.md
file-type-iconLICENSE
file-type-iconNOTICE
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf

Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconroot-example
file-type-iconREADME.md
file-type-iconuser-data-consul.sh
file-type-iconuser-data-vault.sh
file-type-iconvault-agent
file-type-iconvault-auto-unseal
file-type-iconvault-cluster-private
file-type-iconvault-consul-ami
file-type-iconvault-ec2-auth
file-type-iconvault-examples-helper
file-type-iconvault-iam-auth
file-type-iconvault-s3-backend
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconCONTRIBUTING.md
file-type-iconLICENSE
file-type-iconNOTICE
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf
HashiCorp Vault

HashiCorp Vault

Deploy a Vault cluster. Supports automatic bootstrapping, Consul and S3 backends, self-signed TLS certificates, and auto healing.

Code Preview

Preview the Code

mobile file icon

README.md

down

Public Vault Cluster Example

This folder shows an example of Terraform code to deploy a Vault cluster in AWS using the vault-cluster and vault-elb modules. The Vault cluster uses Consul as a storage backend, so this example also deploys a separate Consul server cluster using the consul-cluster module from the Consul AWS Module.

This example creates a public Vault cluster that is accessible from the public Internet via an Elastic Load Balancer (ELB). For an example of a private Vault cluster that is accessible from inside the AWS account, see vault-cluster-private.

Vault architecture

You will need to create an Amazon Machine Image (AMI) that has Vault and Consul installed, which you can do using the vault-consul-ami example).

For more info on how the Vault cluster works, check out the vault-cluster documentation.

Note: To keep this example as simple to deploy and test as possible, it deploys the Vault cluster into your default VPC and default subnets, all of which are publicly accessible. This is OK for learning and experimenting, but for production usage, we strongly recommend deploying the Vault cluster into the private subnets of a custom VPC.

Quick start

To deploy a Vault Cluster:

  1. git clone this repo to your computer.
  2. Optional: build a Vault and Consul AMI. See the vault-consul-ami example documentation for instructions. Make sure to note down the ID of the AMI.
  3. Install Terraform.
  4. Open variables.tf, set the environment variables specified at the top of the file, and fill in any other variables that don't have a default. If you built a custom AMI, put the AMI ID into the ami_id variable. Otherwise, one of our public example AMIs will be used by default. These AMIs are great for learning/experimenting, but are NOT recommended for production use.
  5. Run terraform init.
  6. Run terraform apply.
  7. Run the vault-examples-helper.sh script to print out the IP addresses of the Vault servers and some example commands you can run to interact with the cluster: ../vault-examples-helper/vault-examples-helper.sh. NOTE: This script assumes that you have a valid SSH key set for the variable ssh_key_name.

To see how to connect to the Vault cluster, initialize it, and start reading and writing secrets, head over to the How do you use the Vault cluster? docs.

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?