Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconexamples
file-type-iconchronograf-ami
file-type-iconinfluxdb-ami
file-type-iconconfig
file-type-iconREADME.md
file-type-iconinfluxdb.json
file-type-iconinfluxdb-cluster-simple
file-type-iconkapacitor-ami
file-type-iconlocal-mocks
file-type-icontelegraf-ami
file-type-icontick-ami
file-type-icontick-multi-cluster
file-type-icontick-single-cluster
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
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_docs
file-type-iconexamples
file-type-iconchronograf-ami
file-type-iconinfluxdb-ami
file-type-iconconfig
file-type-iconREADME.md
file-type-iconinfluxdb.json
file-type-iconinfluxdb-cluster-simple
file-type-iconkapacitor-ami
file-type-iconlocal-mocks
file-type-icontelegraf-ami
file-type-icontick-ami
file-type-icontick-multi-cluster
file-type-icontick-single-cluster
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
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
InfluxDB

InfluxDB

Deploy an InfluxDB cluster. Supports automatic bootstrapping and auto healing.

Code Preview

Preview the Code

mobile file icon

README.md

down

InfluxDB AMI

This folder shows an example of how to use the install-influxdb modules with Packer to create Amazon Machine Images (AMIs) that have InfluxDB Enterprise, and its dependencies installed on top of:

  1. Ubuntu 18.04
  2. Amazon Linux 2

Quick start

To build the InfluxDB AMI:

  1. git clone this repo to your computer.
  2. Install Packer.
  3. Configure your AWS credentials using one of the options supported by the AWS SDK. Usually, the easiest option is to set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
  4. Update the variables section of the influxdb.json Packer template to specify the AWS region and InfluxDB version you wish to use.
  5. To build an Ubuntu AMI for InfluxDB Enterprise: packer build -only=ubuntu-ami influxdb.json.
  6. To build an Amazon Linux AMI for InfluxDB Enterprise: packer build -only=amazon-linux-ami influxdb.json.

When the build finishes, it will output the IDs of the new AMIs. To see how to deploy this AMI, check out the influxdb-cluster-simple and tick-multi-cluster examples.

Creating your own Packer template for production usage

When creating your own Packer template for production usage, you can copy the example in this folder more or less exactly, except for one change: we recommend replacing the file provisioner with a call to git clone in a shell provisioner. Instead of:

{
  "provisioners": [{
    "type": "file",
    "source": "{{template_dir}}/../../../terraform-aws-influx",
    "destination": "/tmp"
  },{
    "type": "shell",
    "inline": [
      "/tmp/terraform-aws-influx/modules/install-influxdb/install-influxdb --version {{user `influxdb_version`}}"
    ],
    "pause_before": "30s"
  }]
}

Your code should look more like this:

{
  "provisioners": [{
    "type": "shell",
    "inline": [
      "git clone --branch <MODULE_VERSION> https://github.com/gruntwork-io/terraform-aws-influx.git /tmp/terraform-aws-influx",
      "/tmp/terraform-aws-influx/modules/install-influxdb/install-influxdb --version {{user `influxdb_version`}}"
    ],
    "pause_before": "30s"
  }]
}

You should replace <MODULE_VERSION> in the code above with the version of this module that you want to use (see the Releases Page for all available versions). That's because for production usage, you should always use a fixed, known version of this Module, downloaded from the official Git repo via git clone. On the other hand, when you're just experimenting with the Module, it's OK to use a local checkout of the Module, uploaded from your own computer via the file provisioner.

Local testing

The Packer template in this example folder can build not only AMIs, but also Docker images for local testing. This is convenient for testing out the various scripts in the modules folder without having to wait for an AMI to build and a bunch of EC2 Instances to boot up. See the local-mocks folder for instructions.

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?