This folder defines a Terraform module, which you can use in your
code by adding a module configuration and setting its source parameter to URL of this folder:
module"influxdb_data_cluster" {
# TODO: replace <VERSION> with the latest version from the releases page: https://github.com/gruntwork-io/terraform-aws-influx/releases
source = "github.com/gruntwork-io/terraform-aws-influx//modules/influxdb-cluster?ref=<VERSION>"# Specify the ID of the InfluxDB AMI. You should build this using the scripts in the install-influxdb module.
ami_id = "ami-abcd1234"# Configure and start InfluxDB during boot.
user_data = <<-EOF
#!/bin/bash
sudo systemctl start influxdb
EOF
# ... See variables.tf for the other parameters you must define for the influxdb-cluster module
}
Note the following parameters:
source: Use this parameter to specify the URL of the influxdb-cluster module. The double slash (//) is
intentional and required. Terraform uses it to specify subfolders within a Git repo (see module
sources). The ref parameter specifies a specific Git tag in
this repo. That way, instead of using the latest version of this module from the master branch, which
will change every time you run Terraform, you're using a fixed version of the repo.
ami_id: Use this parameter to specify the ID of an InfluxDB Amazon Machine Image
(AMI) to deploy on each server in the cluster. You
should install InfluxDB the scripts in the
install-influxdb module.
user_data: Use this parameter to specify a User
Data script that each
server will run during boot. This is where you can use the
run-influxdb
script to configure and run InfluxDB as either a meta node or a data node.
You can find the other parameters in variables.tf.
Check out the examples folder for
fully-working sample code.
Why InfluxDB enterprise?
Unlike the Enterprise edition which distributes the entire InfluxDB deployment across multiple meta and data nodes in a cluster,
the OSS edition is a single binary that can simply be installed on a single instance. This makes a robust module like this one
quite unnecessary for single instance InfluxDB OSS deployments.
How do you connect to the InfluxDB cluster?
While InfluxDB doesn't use a load balancer for intra-cluster communication, one can be optionally setup to communicate
with a data cluster from the outside world. An Application Load Balancer is deployed in front of the cluster
and you can use the InfluxDB CLI
to connect to the load balancer on port 8086. Alternatively, you can use the InfluxDB SDK for your programming language of choice.
This module runs InfluxDB on top of an Auto Scaling Group (ASG). Typically, you
should run the ASG with multiple Instances spread across multiple Availability
Zones. Each of the EC2
Instances should be running an AMI that has InfluxDB installed via the
install-influxdb
module. You pass in the ID of the AMI to run using the ami_id input parameter.
The run-influxdb script ensures that
a new node added by an ASG scale-up event automatically joins the existing cluster. However, you're responsible for de-registering
any dead nodes (terminated EC2 instance) from the cluster when the ASG scales down. See the cluster commands
guide for instructions.
EBS Volumes
This module can optionally create an EBS volume for each EC2 Instance in the ASG. You
can use these volume to store InfluxDB data and are mandotory for InfluxDB data nodes.
We recommend a single EBS volume for the meta nodes for storing its Raft database. And one for data nodes,
to store the /data, /meta, /wal, and /hh direcotries.
Backup and Replication
Setting up an adequate backup and recovery mechanism fo your cluster is hugely important. InfluxDB when used with some
other components of the TICK stack has a very capable multi-datacenter
and cross-cluster replication system. You can find more information of InfluxDB disaster recovery here.
Security Group
Each EC2 Instance in the ASG has a Security Group that allows minimal connectivity:
All outbound requests
Inbound SSH access from the CIDR blocks and security groups you specify
The Security Group ID is exported as an output variable which you can use with the
influxdb-security-group-rules
module to open up all the ports necessary for InfluxDB.
IAM Role and Permissions
Each EC2 Instance in the ASG has an IAM Role attached.
The IAM Role ARN and ID are exported as output variables if you need to add additional permissions.
How do you roll out updates?
This module currently doesn't support updating the version of InfluxDB installed across the cluster. You can however follow
this guide to manually perform the upgrade.
Dedicated instances
If you wish to use dedicated instances, you can set the tenancy parameter to "dedicated" in this module.
Encryption
This module does not currently support specifying encryption information. The official documentation contains a guide for enabling SSL.
Security groups
This module attaches a security group to each EC2 Instance that allows inbound requests as follows:
SSH: For the SSH port (default: 22), you can use the allowed_ssh_cidr_blocks parameter to control the list of CIDR blocks that will be allowed access. You can use
the allowed_inbound_ssh_security_group_ids parameter to control the list of source Security Groups that will be
allowed access.
The ID of the security group is exported as an output variable, which you can use with the
influxdb-security-group-rules
module to open up all the ports necessary for InfluxDB.
SSH access
You can associate an EC2 Key Pair with each
of the EC2 Instances in this cluster by specifying the Key Pair's name in the ssh_key_name variable. If you don't
want to associate a Key Pair with these servers, set ssh_key_name to an empty string.
Questions? Ask away.
We're here to talk about our services, answer any questions, give advice, or just to chat.
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"f9f681ec70f1e06fb621f9909cea240061b82b07"},{"name":"publish-amis.sh","path":".circleci/publish-amis.sh","sha":"a6c7771129b46556d6863050b3b80abbb632eb36"}]},{"name":".gitignore","path":".gitignore","sha":"1d4e847f6ea857f7842d5d56048758497c58ef7c"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"752f3f77602eb7f38ce57c5e6c6dfd8b7cb14367"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"4be01a6334d39aa5bf6abe6baae701f5e2a8c5ac"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","sha":"d02a77a6cf6e01e82938efb4ea53caab2d09a948"},{"name":"LICENSE","path":"LICENSE","sha":"7a4a3ea2424c09fbe48d455aed1eaa94d9124835"},{"name":"NOTICE","path":"NOTICE","sha":"1cc6603154b36da82afb433b6de6ba6b40445e39"},{"name":"README.md","path":"README.md","sha":"29ecbaf4c2af37ea4d2264171d7163152f738709"},{"name":"_docs","children":[{"name":"influxdb-multi-cluster-architecture.png","path":"_docs/influxdb-multi-cluster-architecture.png","sha":"0a22215c9b16f627f97c29588de014d8c23030b3"},{"name":"influxdb-single-cluster-architecture.png","path":"_docs/influxdb-single-cluster-architecture.png","sha":"c5b73dc6575abb032a97d81dafdffeb0c332c26f"},{"name":"tick-multi-cluster-architecture.png","path":"_docs/tick-multi-cluster-architecture.png","sha":"32b8045f0cbcd463b3813e6942965950ad20cddd"}]},{"name":"examples","children":[{"name":"chronograf-ami","children":[{"name":"README.md","path":"examples/chronograf-ami/README.md","sha":"12219d95ac4f7748cc704123dcd1aaa56ae786da"},{"name":"chronograf.json","path":"examples/chronograf-ami/chronograf.json","sha":"0313d0bd477999509254a30b9b88a7b76eb15e40"},{"name":"config","children":[{"name":"chronograf","path":"examples/chronograf-ami/config/chronograf","sha":"8c33b68c638a13593023ad87b6a3dc907bce3a6f"}]}]},{"name":"influxdb-ami","children":[{"name":"README.md","path":"examples/influxdb-ami/README.md","sha":"7347a431c9405d00c3c96042908c66119103d47c"},{"name":"config","children":[{"name":"influxdb-meta.conf","path":"examples/influxdb-ami/config/influxdb-meta.conf","sha":"7ad2a20080cd748eda3ddf29c1841845a897374d"},{"name":"influxdb.conf","path":"examples/influxdb-ami/config/influxdb.conf","sha":"36f19e69835fadc72781f3f606a77c65225deb4b"}]},{"name":"influxdb.json","path":"examples/influxdb-ami/influxdb.json","sha":"1ea4373793061adaddb86809c58c4923e63c8642"}]},{"name":"influxdb-cluster-simple","children":[{"name":"README.md","path":"examples/influxdb-cluster-simple/README.md","sha":"e68a61dbc9a8d989858c5df6dfb79c38fc6052ba"},{"name":"local-test","children":[{"name":".env","path":"examples/influxdb-cluster-simple/local-test/.env","sha":"d94f35ff4c4d7003bed1fd96b1abd8e487326f4c"},{"name":"docker-compose.yml","path":"examples/influxdb-cluster-simple/local-test/docker-compose.yml","sha":"aceb84dad407fd0d42cdcb0d5a577c343c573046"}]},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/influxdb-cluster-simple/user-data/user-data.sh","sha":"0c0c204a6ef8d564e137898379ab8efff146f22c"}]}]},{"name":"kapacitor-ami","children":[{"name":"README.md","path":"examples/kapacitor-ami/README.md","sha":"ddb815351fe872d219134f4ab6d39e88511b2431"},{"name":"config","children":[{"name":"kapacitor.conf","path":"examples/kapacitor-ami/config/kapacitor.conf","sha":"c70c256d2fdbf953a7a5b65d0111817212e5fb41"}]},{"name":"kapacitor.json","path":"examples/kapacitor-ami/kapacitor.json","sha":"e89b486d399541454ebde7aa799c28f4de390cfa"}]},{"name":"local-mocks","children":[{"name":"README.md","path":"examples/local-mocks/README.md","sha":"1e4ccdc3830140359c5bc2a19259043c21fd82b5"},{"name":"aws.sh","path":"examples/local-mocks/aws.sh","sha":"2ff858b6ce486b5a39c78d5b6421f35032ccb3d8"},{"name":"entrypoint.sh","path":"examples/local-mocks/entrypoint.sh","sha":"dd4d5596ff45597ad2fa1d7158af36fef70dd9c4"},{"name":"influxdb-common.sh","path":"examples/local-mocks/influxdb-common.sh","sha":"8a67f9e1c37ae3753f95632285c2564a83a23161"},{"name":"mount-volume.sh","path":"examples/local-mocks/mount-volume.sh","sha":"c9fa0b283e7ce1a0b1652dc4565bfe2740dcc820"}]},{"name":"telegraf-ami","children":[{"name":"README.md","path":"examples/telegraf-ami/README.md","sha":"5088b7d28693aef395915c1f4a5ec4b4ab92f4fd"},{"name":"config","children":[{"name":"telegraf.conf","path":"examples/telegraf-ami/config/telegraf.conf","sha":"ef7ab46f69c9f543ed4194572fdc8fbad996fb47"}]},{"name":"telegraf.json","path":"examples/telegraf-ami/telegraf.json","sha":"3724bbc99ebc61eef8f0e9e5e231513a57c44ebf"}]},{"name":"tick-ami","children":[{"name":"README.md","path":"examples/tick-ami/README.md","sha":"3fae3c0c11cc2dce489d9b1198248ce429df7cc7"},{"name":"tick.json","path":"examples/tick-ami/tick.json","sha":"f01ee54c1abe4c9cac789f077a56ba440c21c675"}]},{"name":"tick-multi-cluster","children":[{"name":"local-test","children":[{"name":".env","path":"examples/tick-multi-cluster/local-test/.env","sha":"e8f0451b5ea9b681e2cecc7e23cc32cf27dae594"},{"name":"docker-compose.yml","path":"examples/tick-multi-cluster/local-test/docker-compose.yml","sha":"523f12abb9afa2ac4d44957f868b76bb6c58d5e6"}]},{"name":"main.tf","path":"examples/tick-multi-cluster/main.tf","sha":"e3820481b8a2c71c50960d584540c75159fc1ffe"},{"name":"outputs.tf","path":"examples/tick-multi-cluster/outputs.tf","sha":"cc36d3551216edcb0962884d8a8d9c6cc494c57e"},{"name":"user-data","children":[{"name":"chronograf","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/chronograf/user-data.sh","sha":"edcce4a9467877075ef2d5a130f957cb5bb0d342"}]},{"name":"influxdb","children":[{"name":"data-node","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/influxdb/data-node/user-data.sh","sha":"94be7d4ab9c4fbda493e2aaf56acb632ce1d5f83"}]},{"name":"meta-node","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/influxdb/meta-node/user-data.sh","sha":"81ef63c6880d86ee2a2a1f87b41bd5624aea768c"}]}]},{"name":"kapacitor","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/kapacitor/user-data.sh","sha":"85fa24bc49c3c129f3e67ae0f350455f8a0a5a4f"}]},{"name":"telegraf","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/telegraf/user-data.sh","sha":"1f45737e928c4b4407c23eb6b4230ffc507135e2"}]}]},{"name":"variables.tf","path":"examples/tick-multi-cluster/variables.tf","sha":"d4a98c4c302739f19e49fcae0d8f83d8dd0790de"}]},{"name":"tick-single-cluster","children":[{"name":"README.md","path":"examples/tick-single-cluster/README.md","sha":"8af5285a92db39248ecd0c0126a19881b1a7ec0b"},{"name":"local-test","children":[{"name":".env","path":"examples/tick-single-cluster/local-test/.env","sha":"9aab6b098221a61e5783ac141f52ab9c76c617f2"},{"name":"docker-compose.yml","path":"examples/tick-single-cluster/local-test/docker-compose.yml","sha":"1d533b6bc7808b216a21deeb6e4683be4aada216"}]},{"name":"main.tf","path":"examples/tick-single-cluster/main.tf","sha":"e76d85585578b446d4b9f4566d1678f0b1e6f6fa"},{"name":"outputs.tf","path":"examples/tick-single-cluster/outputs.tf","sha":"1f6582af089670a544838f8daf2d6b9443d714bf"},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/tick-single-cluster/user-data/user-data.sh","sha":"3761f7be138ac64ef9a23345791a45b6bae231f0"}]},{"name":"variables.tf","path":"examples/tick-single-cluster/variables.tf","sha":"766f1a00791ef7fd92728191d472349360ee4e5e"}]}]},{"name":"main.tf","path":"main.tf","sha":"7f83810cbd2d7b830a929660cc9adf014f7b0191"},{"name":"modules","children":[{"name":"chronograf-security-group-rules","children":[{"name":"README.md","path":"modules/chronograf-security-group-rules/README.md","sha":"ba653f803e7caeaa46d4d6205b59c5ca2f975ce4"},{"name":"main.tf","path":"modules/chronograf-security-group-rules/main.tf","sha":"c5b95770f9f478b91aa3025eb3bc6db52cfa4ed9"},{"name":"outputs.tf","path":"modules/chronograf-security-group-rules/outputs.tf","sha":"f7f3421d941f6323ac0d1c239c1944bafa558ccc"},{"name":"variables.tf","path":"modules/chronograf-security-group-rules/variables.tf","sha":"e836411856590178128294d05f0fc79899762765"}]},{"name":"chronograf-server","children":[{"name":"README.md","path":"modules/chronograf-server/README.md","sha":"e2110e93fb9b5eabfa4e1b6a5fcd9f6b61a3714e"},{"name":"main.tf","path":"modules/chronograf-server/main.tf","sha":"aa540886702bb8fc041ebb2c99a3cb4f19bf9722"},{"name":"outputs.tf","path":"modules/chronograf-server/outputs.tf","sha":"a290eaa88481cf8fdce21fee69e87f2a675d6b46"},{"name":"variables.tf","path":"modules/chronograf-server/variables.tf","sha":"412d27de9db1556050013a83398d31b96cc512b8"}]},{"name":"influxdb-cluster","children":[{"name":"README.md","path":"modules/influxdb-cluster/README.md","sha":"1377a05cc13f8f8c6155248e89760a91382141e0","toggled":true},{"name":"main.tf","path":"modules/influxdb-cluster/main.tf","sha":"4baf70b04ff38d86987665819adc69b03f13f513"},{"name":"outputs.tf","path":"modules/influxdb-cluster/outputs.tf","sha":"a290eaa88481cf8fdce21fee69e87f2a675d6b46"},{"name":"variables.tf","path":"modules/influxdb-cluster/variables.tf","sha":"4b648c75401df28be3ebb92a61eaff61d32d56b5"}],"toggled":true},{"name":"influxdb-commons","children":[{"name":"influxdb-common.sh","path":"modules/influxdb-commons/influxdb-common.sh","sha":"1ced7551708487f10210c2e10eedcff4336fd4b6"},{"name":"mount-volume.sh","path":"modules/influxdb-commons/mount-volume.sh","sha":"ea92e25a009991796e13542117d9aeee2e77bdf3"}]},{"name":"influxdb-iam-policies","children":[{"name":"README.md","path":"modules/influxdb-iam-policies/README.md","sha":"114b98b4ee6bf2981b49f85b9f63ff265c22377a"},{"name":"main.tf","path":"modules/influxdb-iam-policies/main.tf","sha":"144c26257265c80b71ea2e6598a5fa588cab91a4"},{"name":"variables.tf","path":"modules/influxdb-iam-policies/variables.tf","sha":"52873644e20b4cafdcc0f33dc11db99f1fa9b586"}]},{"name":"influxdb-security-group-rules","children":[{"name":"README.md","path":"modules/influxdb-security-group-rules/README.md","sha":"417d2edf9ed471cd52caceae6d17d4271d1d50f9"},{"name":"main.tf","path":"modules/influxdb-security-group-rules/main.tf","sha":"3a87176e4e9b7d5e6ec43850606b9953ba8b1b21"},{"name":"outputs.tf","path":"modules/influxdb-security-group-rules/outputs.tf","sha":"5a6f6ae13dd2cd02c5afdfdf8a2986c4e8fd86bd"},{"name":"variables.tf","path":"modules/influxdb-security-group-rules/variables.tf","sha":"1f763c57fe0b502554d004fa112ac03726c8ad01"}]},{"name":"install-chronograf","children":[{"name":"README.md","path":"modules/install-chronograf/README.md","sha":"0265bb8199d0f8b167f88ff20102769e378adc28"},{"name":"install-chronograf","path":"modules/install-chronograf/install-chronograf","sha":"557b391c65eaf8de246f86b43c42a7515671aa6e"}]},{"name":"install-influxdb","children":[{"name":"README.md","path":"modules/install-influxdb/README.md","sha":"e9760321b7164d283c3a67d3aceca99aff74efa1"},{"name":"install-influxdb","path":"modules/install-influxdb/install-influxdb","sha":"28dd51772da06991dcda7040bd7a4e3d41313979"}]},{"name":"install-kapacitor","children":[{"name":"README.md","path":"modules/install-kapacitor/README.md","sha":"94af4c0b91ab86cd35c7fafc1481750cb30f817e"},{"name":"install-kapacitor","path":"modules/install-kapacitor/install-kapacitor","sha":"ede4f4302b14ca8296f0b661244b5006193ba540"}]},{"name":"install-telegraf","children":[{"name":"README.md","path":"modules/install-telegraf/README.md","sha":"873f734214f00d7c45a3f034206811273980a78e"},{"name":"install-telegraf","path":"modules/install-telegraf/install-telegraf","sha":"c36216b7e173a55c0126d96ae5dc4b84f84799dd"}]},{"name":"kapacitor-security-group-rules","children":[{"name":"README.md","path":"modules/kapacitor-security-group-rules/README.md","sha":"7e70898738f0dd781e7b68e0e8d8fb33fdde91fc"},{"name":"main.tf","path":"modules/kapacitor-security-group-rules/main.tf","sha":"a4dabc6bcdfb9c421bdae37f8a0963e3f6ad9f23"},{"name":"outputs.tf","path":"modules/kapacitor-security-group-rules/outputs.tf","sha":"f7f3421d941f6323ac0d1c239c1944bafa558ccc"},{"name":"variables.tf","path":"modules/kapacitor-security-group-rules/variables.tf","sha":"f21b9ff1c047b37c63c24bbc9d1803b9fe02d492"}]},{"name":"kapacitor-server","children":[{"name":"README.md","path":"modules/kapacitor-server/README.md","sha":"609adbe9be1c5189e93c9d9869a05519d4afa9c9"},{"name":"main.tf","path":"modules/kapacitor-server/main.tf","sha":"2c6845d77e1b8d253bd22721277c331dafaf62ce"},{"name":"outputs.tf","path":"modules/kapacitor-server/outputs.tf","sha":"618d0987a275cd153cf22f7745369bfe749fe6b2"},{"name":"variables.tf","path":"modules/kapacitor-server/variables.tf","sha":"ab49dd73e22da2adf8de4c66d318fefc1524350a"}]},{"name":"load-balancer-target-group","children":[{"name":"README.md","path":"modules/load-balancer-target-group/README.md","sha":"561c66859086f8dd877312bb4cc9d05eaf23706e"},{"name":"main.tf","path":"modules/load-balancer-target-group/main.tf","sha":"06d281d12ff069fe7a5c516d442823c7533410f6"},{"name":"outputs.tf","path":"modules/load-balancer-target-group/outputs.tf","sha":"cdf904445cf5099ccea5cc8820d198a1ffba4283"},{"name":"variables.tf","path":"modules/load-balancer-target-group/variables.tf","sha":"e249b8f633bed4ca941a7b5510d5e6f39805ff33"}]},{"name":"load-balancer","children":[{"name":"README.md","path":"modules/load-balancer/README.md","sha":"2748251533467ce849be4fbc6bb4868aea545313"},{"name":"main.tf","path":"modules/load-balancer/main.tf","sha":"271d8f729e6486b32501184448b3ac2a0172b837"},{"name":"outputs.tf","path":"modules/load-balancer/outputs.tf","sha":"26a741cce6b75f2c60339aefea93d5c99b862222"},{"name":"variables.tf","path":"modules/load-balancer/variables.tf","sha":"10f5715eba776610dd713ce1d59938c4fe6cb078"}]},{"name":"run-chronograf","children":[{"name":"README.md","path":"modules/run-chronograf/README.md","sha":"31ad5434745d5e4e05c289ded3ae85d5faaacd75"},{"name":"run-chronograf","path":"modules/run-chronograf/run-chronograf","sha":"29fe5710e71333e6aa3b7b37ab8ab812d5b3b53b"}]},{"name":"run-influxdb","children":[{"name":"README.md","path":"modules/run-influxdb/README.md","sha":"41fc1a499b85c3c8f29a8a051b9965de00048889"},{"name":"run-influxdb","path":"modules/run-influxdb/run-influxdb","sha":"47755e2a21f2453ba949092bd76c0c110b5076db"}]},{"name":"run-kapacitor","children":[{"name":"README.md","path":"modules/run-kapacitor/README.md","sha":"0aeb557ba7f4f6c904af560f5eefa4acacaa4373"},{"name":"run-kapacitor","path":"modules/run-kapacitor/run-kapacitor","sha":"3394dc6e702aeb78e168d81c433af48df70927c6"}]},{"name":"run-telegraf","children":[{"name":"README.md","path":"modules/run-telegraf/README.md","sha":"ac8d874e452929be5a4b4c00446568c10bd10de5"},{"name":"run-telegraf","path":"modules/run-telegraf/run-telegraf","sha":"724af683538e33ed4c51d0204202c04cf1cdc14f"}]}],"toggled":true},{"name":"outputs.tf","path":"outputs.tf","sha":"1d2464bda76ea8f452773ebc69b41e3b65b1c827"},{"name":"test","children":[{"name":"Gopkg.lock","path":"test/Gopkg.lock","sha":"99df58080a1f0db4565d214129c32b4e1a4769e2"},{"name":"Gopkg.toml","path":"test/Gopkg.toml","sha":"b6373bead7b213d542e3564e5915ac2ffde5f0b8"},{"name":"README.md","path":"test/README.md","sha":"819e790d15767c851bfc438f0a1413ed2bde7d3b"},{"name":"influxdb_single_cluster_test.go","path":"test/influxdb_single_cluster_test.go","sha":"4dc35665cb26dbecd2cb7f9d33d64319797f2305"},{"name":"test_helpers.go","path":"test/test_helpers.go","sha":"1bbda8373251e26156a8b3422bc338d19d56aa10"},{"name":"tick_multi_cluster_test.go","path":"test/tick_multi_cluster_test.go","sha":"cc48d14f53f7f6df04e8e441d33788c2ac575344"},{"name":"tick_single_cluster_test.go","path":"test/tick_single_cluster_test.go","sha":"97921520812154ba4198ea7f33fe38a5df49b77d"}]},{"name":"variables.tf","path":"variables.tf","sha":"c1aa8ee0980cb0fd3a83f90e67407a510420131d"}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"influx-db-cluster\">InfluxDB Cluster</h1><div class=\"preview__body--border\"></div><p>This folder contains a <a href=\"https://www.terraform.io/\" class=\"preview__body--description--blue\" target=\"_blank\">Terraform</a> module to deploy an <a href=\"https://www.influxdata.com/time-series-platform/influxdb/\" class=\"preview__body--description--blue\" target=\"_blank\">InfluxDB Enterprise</a> cluster in <a href=\"https://aws.amazon.com/\" class=\"preview__body--description--blue\" target=\"_blank\">AWS</a> on top of an Auto Scaling Group.\nThe idea is to create an <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html\" class=\"preview__body--description--blue\" target=\"_blank\">Amazon Machine Image (AMI)</a>\nthat has InfluxDB meta and data binaries installed using the <a href=\"/repos/v0.1.2/terraform-aws-influx/modules/install-influxdb\" class=\"preview__body--description--blue\">install-influxdb</a> module.</p>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-use-this-module\">How do you use this module?</h2>\n<p>This folder defines a <a href=\"https://www.terraform.io/docs/modules/usage.html\" class=\"preview__body--description--blue\" target=\"_blank\">Terraform module</a>, which you can use in your\ncode by adding a <code>module</code> configuration and setting its <code>source</code> parameter to URL of this folder:</p>\n<pre><span class=\"hljs-keyword\">module</span> <span class=\"hljs-string\">\"influxdb_data_cluster\"</span> {\n <span class=\"hljs-comment\"># <span class=\"hljs-doctag\">TODO:</span> replace <VERSION> with the latest version from the releases page: https://github.com/gruntwork-io/terraform-aws-influx/releases</span>\n source = <span class=\"hljs-string\">\"github.com/gruntwork-io/terraform-aws-influx//modules/influxdb-cluster?ref=<VERSION>\"</span>\n\n <span class=\"hljs-comment\"># Specify the ID of the InfluxDB AMI. You should build this using the scripts in the install-influxdb module.</span>\n ami_id = <span class=\"hljs-string\">\"ami-abcd1234\"</span>\n \n <span class=\"hljs-comment\"># Configure and start InfluxDB during boot. </span>\n user_data = <<-EOF\n <span class=\"hljs-comment\">#!/bin/bash</span>\n sudo systemctl start influxdb\n EOF\n \n <span class=\"hljs-comment\"># ... See variables.tf for the other parameters you must define for the influxdb-cluster module</span>\n}\n</pre>\n<p>Note the following parameters:</p>\n<ul>\n<li>\n<p><code>source</code>: Use this parameter to specify the URL of the influxdb-cluster module. The double slash (<code>//</code>) is\nintentional and required. Terraform uses it to specify subfolders within a Git repo (see <a href=\"https://www.terraform.io/docs/modules/sources.html\" class=\"preview__body--description--blue\" target=\"_blank\">module\nsources</a>). The <code>ref</code> parameter specifies a specific Git tag in\nthis repo. That way, instead of using the latest version of this module from the <code>master</code> branch, which\nwill change every time you run Terraform, you're using a fixed version of the repo.</p>\n</li>\n<li>\n<p><code>ami_id</code>: Use this parameter to specify the ID of an InfluxDB <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html\" class=\"preview__body--description--blue\" target=\"_blank\">Amazon Machine Image\n(AMI)</a> to deploy on each server in the cluster. You\nshould install InfluxDB the scripts in the\n<a href=\"/repos/v0.1.2/terraform-aws-influx/modules/install-influxdb\" class=\"preview__body--description--blue\">install-influxdb</a> module.</p>\n</li>\n<li>\n<p><code>user_data</code>: Use this parameter to specify a <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts\" class=\"preview__body--description--blue\" target=\"_blank\">User\nData</a> script that each\nserver will run during boot. This is where you can use the\n<a href=\"/repos/v0.1.2/terraform-aws-influx/modules/run-influxdb\" class=\"preview__body--description--blue\">run-influxdb</a>\nscript to configure and run InfluxDB as either a meta node or a data node.</p>\n</li>\n</ul>\n<p>You can find the other parameters in <a href=\"/repos/v0.1.2/terraform-aws-influx/modules/influxdb-cluster/variables.tf\" class=\"preview__body--description--blue\">variables.tf</a>.</p>\n<p>Check out the <a href=\"/repos/v0.1.2/terraform-aws-influx/examples\" class=\"preview__body--description--blue\">examples folder</a> for\nfully-working sample code.</p>\n<h2 class=\"preview__body--subtitle\" id=\"why-influx-db-enterprise\">Why InfluxDB enterprise?</h2>\n<p>Unlike the Enterprise edition which distributes the entire InfluxDB deployment across multiple meta and data nodes in a cluster,\nthe OSS edition is a single binary that can simply be installed on a single instance. This makes a robust module like this one\nquite unnecessary for single instance InfluxDB OSS deployments.</p>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-connect-to-the-influx-db-cluster\">How do you connect to the InfluxDB cluster?</h2>\n<p>While InfluxDB doesn't use a load balancer for intra-cluster communication, one can be optionally setup to communicate\nwith a data cluster from the outside world. An <a href=\"http://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html\" class=\"preview__body--description--blue\" target=\"_blank\">Application Load Balancer</a> is deployed in front of the cluster\nand you can use the <a href=\"https://docs.influxdata.com/influxdb/v1.6/tools/shell/\" class=\"preview__body--description--blue\" target=\"_blank\">InfluxDB CLI</a>\nto connect to the load balancer on port <code>8086</code>. Alternatively, you can use the <a href=\"https://docs.influxdata.com/influxdb/v1.6/tools/api_client_libraries/\" class=\"preview__body--description--blue\" target=\"_blank\">InfluxDB SDK</a> for your programming language of choice.</p>\n<h2 class=\"preview__body--subtitle\" id=\"whats-included-in-this-module\">What's included in this module?</h2>\n<p>This module creates the following:</p>\n<ul>\n<li><a href=\"#auto-scaling-group\" class=\"preview__body--description--blue\">Auto Scaling Group</a></li>\n<li><a href=\"#ebs-volumes\" class=\"preview__body--description--blue\">EBS Volumes</a></li>\n<li><a href=\"#security-group\" class=\"preview__body--description--blue\">Security Group</a></li>\n<li><a href=\"#iam-role-and-permissions\" class=\"preview__body--description--blue\">IAM Role and Permissions</a></li>\n</ul>\n<h3 class=\"preview__body--subtitle\" id=\"auto-scaling-group\">Auto Scaling Group</h3>\n<p>This module runs InfluxDB on top of an <a href=\"https://aws.amazon.com/autoscaling/\" class=\"preview__body--description--blue\" target=\"_blank\">Auto Scaling Group (ASG)</a>. Typically, you\nshould run the ASG with multiple Instances spread across multiple <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html\" class=\"preview__body--description--blue\" target=\"_blank\">Availability\nZones</a>. Each of the EC2\nInstances should be running an AMI that has InfluxDB installed via the\n<a href=\"/repos/v0.1.2/terraform-aws-influx/modules/install-influxdb\" class=\"preview__body--description--blue\">install-influxdb</a>\nmodule. You pass in the ID of the AMI to run using the <code>ami_id</code> input parameter.</p>\n<p>The <a href=\"/repos/v0.1.2/terraform-aws-influx/modules/run-influxdb\" class=\"preview__body--description--blue\">run-influxdb</a> script ensures that\na new node added by an ASG scale-up event automatically joins the existing cluster. However, you're responsible for de-registering\nany dead nodes (terminated EC2 instance) from the cluster when the ASG scales down. See the <a href=\"https://docs.influxdata.com/enterprise_influxdb/v1.5/features/cluster-commands/\" class=\"preview__body--description--blue\" target=\"_blank\">cluster commands\nguide</a> for instructions.</p>\n<h3 class=\"preview__body--subtitle\" id=\"ebs-volumes\">EBS Volumes</h3>\n<p>This module can optionally create an <a href=\"https://aws.amazon.com/ebs/\" class=\"preview__body--description--blue\" target=\"_blank\">EBS volume</a> for each EC2 Instance in the ASG. You\ncan use these volume to store InfluxDB data and are mandotory for InfluxDB data nodes.</p>\n<p>We recommend a single EBS volume for the meta nodes for storing its Raft database. And one for data nodes,\nto store the <code>/data</code>, <code>/meta</code>, <code>/wal</code>, and <code>/hh</code> direcotries.</p>\n<h3 class=\"preview__body--subtitle\" id=\"backup-and-replication\">Backup and Replication</h3>\n<p>Setting up an adequate backup and recovery mechanism fo your cluster is hugely important. InfluxDB when used with some\nother components of the <a href=\"https://www.influxdata.com/time-series-platform/\" class=\"preview__body--description--blue\" target=\"_blank\">TICK stack</a> has a very capable multi-datacenter\nand cross-cluster replication system. You can find more information of InfluxDB disaster recovery <a href=\"https://www.influxdata.com/blog/multiple-data-center-replication-influxdb/\" class=\"preview__body--description--blue\" target=\"_blank\">here</a>.</p>\n<h3 class=\"preview__body--subtitle\" id=\"security-group\">Security Group</h3>\n<p>Each EC2 Instance in the ASG has a Security Group that allows minimal connectivity:</p>\n<ul>\n<li>All outbound requests</li>\n<li>Inbound SSH access from the CIDR blocks and security groups you specify</li>\n</ul>\n<p>The Security Group ID is exported as an output variable which you can use with the\n<a href=\"/repos/v0.1.2/terraform-aws-influx/modules/influxdb-security-group-rules\" class=\"preview__body--description--blue\">influxdb-security-group-rules</a>\nmodule to open up all the ports necessary for InfluxDB.</p>\n<h3 class=\"preview__body--subtitle\" id=\"iam-role-and-permissions\">IAM Role and Permissions</h3>\n<p>Each EC2 Instance in the ASG has an <a href=\"http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html\" class=\"preview__body--description--blue\" target=\"_blank\">IAM Role</a> attached.\nThe IAM Role ARN and ID are exported as output variables if you need to add additional permissions.</p>\n<h3 class=\"preview__body--subtitle\" id=\"how-do-you-roll-out-updates\">How do you roll out updates?</h3>\n<p>This module currently doesn't support updating the version of InfluxDB installed across the cluster. You can however follow\nthis <a href=\"https://docs.influxdata.com/enterprise_influxdb/v1.6/administration/upgrading/\" class=\"preview__body--description--blue\" target=\"_blank\">guide</a> to manually perform the upgrade.</p>\n<h3 class=\"preview__body--subtitle\" id=\"dedicated-instances\">Dedicated instances</h3>\n<p>If you wish to use dedicated instances, you can set the <code>tenancy</code> parameter to <code>"dedicated"</code> in this module.</p>\n<h3 class=\"preview__body--subtitle\" id=\"encryption\">Encryption</h3>\n<p>This module does not currently support specifying encryption information. The official <a href=\"https://docs.influxdata.com/influxdb/v1.6/administration/https_setup/\" class=\"preview__body--description--blue\" target=\"_blank\">documentation</a> contains a guide for enabling SSL.</p>\n<h3 class=\"preview__body--subtitle\" id=\"security-groups\">Security groups</h3>\n<p>This module attaches a security group to each EC2 Instance that allows inbound requests as follows:</p>\n<ul>\n<li><strong>SSH</strong>: For the SSH port (default: 22), you can use the <code>allowed_ssh_cidr_blocks</code> parameter to control the list of<br>\n<a href=\"https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\" class=\"preview__body--description--blue\" target=\"_blank\">CIDR blocks</a> that will be allowed access. You can use\nthe <code>allowed_inbound_ssh_security_group_ids</code> parameter to control the list of source Security Groups that will be\nallowed access.</li>\n</ul>\n<p>The ID of the security group is exported as an output variable, which you can use with the\n<a href=\"/repos/v0.1.2/terraform-aws-influx/modules/influxdb-security-group-rules\" class=\"preview__body--description--blue\">influxdb-security-group-rules</a>\nmodule to open up all the ports necessary for InfluxDB.</p>\n<h3 class=\"preview__body--subtitle\" id=\"ssh-access\">SSH access</h3>\n<p>You can associate an <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html\" class=\"preview__body--description--blue\" target=\"_blank\">EC2 Key Pair</a> with each\nof the EC2 Instances in this cluster by specifying the Key Pair's name in the <code>ssh_key_name</code> variable. If you don't\nwant to associate a Key Pair with these servers, set <code>ssh_key_name</code> to an empty string.</p>\n","repoName":"terraform-aws-influx","repoRef":"v0.1.2","serviceDescriptor":{"serviceName":"InfluxDB","serviceRepoName":"terraform-aws-influx","serviceRepoOrg":"gruntwork-io","cloudProviders":["aws"],"description":"Deploy an InfluxDB cluster. Supports automatic bootstrapping and auto healing.","imageUrl":"tick.png","licenseType":"open-source","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"NoSQL","fileName":"README.md","filePath":"/modules/influxdb-cluster","title":"Repo Browser: InfluxDB","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}