Use InfluxDB templates
This page documents an earlier version of InfluxDB OSS. InfluxDB 3 Core is the latest stable version.
Use the influx command line interface (CLI) to summarize, validate, and apply
templates from your local filesystem and from URLs.
Use InfluxDB community templates
The InfluxDB community templates repository is home to a growing number of InfluxDB templates developed and maintained by others in the InfluxData community. Apply community templates directly from GitHub using a template’s download URL or download the template.
The community templates are under the following root URL:
https://raw.githubusercontent.com/influxdata/community-templates/master/For example, to access the Docker community template, use the following URL:
https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.ymlView InfluxDB Community Templates
View a template summary
To view a summary of what’s included in a template before applying the template,
use the influx template command.
View a summary of a template stored in your local filesystem or from a URL.
# Syntax
influx template -f <FILE_PATH># Example
influx template -org ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml# Syntax
influx template -org <ORG_NAME> -u <FILE_URL># Example
influx template -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.ymlValidate a template
To validate a template before you install it or troubleshoot a template, use
the influx template validate command.
Validate a template stored in your local filesystem or from a URL.
# Syntax
influx template validate -org <ORG_NAME> -f <FILE_PATH># Example
influx template validate -org ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml# Syntax
influx template validate -u <FILE_URL># Example
influx template validate -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.ymlApply templates
Use the influx apply command to install templates
from your local filesystem or from URLs.
The default output is a summary of the template in “pretty” format and a prompt
to confirm applying the changes.
# Syntax
influx apply \
 -o <INFLUX_ORG> \
 -f <FILE_PATH> \
 -u <URL> \
 --secret=<SECRET_KEY>=<SECRET_VALUE>- Apply a template from a file
 - Apply all templates in a directory
 - Apply a template from a URL
 - Apply templates from both files and URLs
 - Define environment references
 - Include a secret when installing a template
 
Apply templates to an existing stack
To apply a template to an existing stack, include the stack ID when applying the template. Any time you apply a template without a stack ID, InfluxDB initializes a new stack and all new resources. For more information, see InfluxDB stacks.
You can extract a stack ID from the output of influx stacks and pass it to influx apply:
# Extract stack ID by name and apply a template to that stack
influx stacks | grep STACK_NAME | awk '{print $1}' | xargs -I{} influx apply -o ORG_NAME -f /path/to/TEMPLATE_FILE.yml --stack-id {}Apply a template from a file
To install templates stored on your local machine, use the -f or --file flag
to provide the file path of the template manifest.
# Example
# Apply multiple templates
influx apply -o ORG_NAME \
  -f /path/to/templates/TEMPLATE_FILE_1.yml \
  -f /path/to/templates/TEMPLATE_FILE_2.ymlTo skip the confirmation and apply the templates non-interactively, pass --force yes:
# Download templates for tests
curl https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml \
  -so /path/to/templates/TEMPLATE_FILE_1.yml &&
curl https://raw.githubusercontent.com/influxdata/community-templates/master/github/github.yml \
  -so /path/to/templates/TEMPLATE_FILE_2.yml &&
influx apply -o ORG_NAME \
  -f /path/to/templates/TEMPLATE_FILE_1.yml \
  -f /path/to/templates/TEMPLATE_FILE_2.yml \
  --force yesApply all templates in a directory
To apply all templates in a directory, use the -f or --file flag to provide
the directory path of the directory where template manifests are stored.
By default, this only applies templates stored in the specified directory.
To apply all templates stored in the specified directory and its subdirectories,
include the -R, --recurse flag.
# Examples
# Apply all templates in a directory
influx apply -o ORG_NAME -f /path/to/templates/
# Apply all templates in a directory and its subdirectories
influx apply -o ORG_NAME -f /path/to/templates/ --recurseApply a template from a URL
To apply templates from a URL, use the -u or --template-url flag to provide the URL
of the template manifest.
# Example
# Apply multiple templates from URLs
influx apply -o ORG_NAME \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/github/github.ymlApply templates from files and URLs
To apply templates from files and URLs in a single command, include multiple
file or directory paths and URLs, each with the appropriate -f or -u flag.
# Example
influx apply -o ORG_NAME \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/raspberry-pi/raspberry-pi-system.yml \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/minio/minio.yml \
  -f /path/to/templates/TEMPLATE_FILE_1.yml \
  -f /path/to/templates/TEMPLATE_FILE_2.yml \
  --recurseDefine environment references
Some templates include environment references that let you provide custom resource names.
The influx apply command prompts you to provide a value for each environment
reference in the template.
You can also provide values for environment references by including an --env-ref
flag with a key-value pair comprised of the environment reference key and the
value to replace it.
# Example
influx apply -o ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml \
  --env-ref=bucket-name-1=myBucket \
  --env-ref=label-name-1=Label1 \
  --env-ref=label-name-2=Label2Include a secret when installing a template
Some templates use secrets in queries.
Secret values are not included in templates.
To define secret values when installing a template, include the --secret flag
with the secret key-value pair.
# Examples
# Define a single secret when applying a template
influx apply -o ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml \
  --secret=FOO=BAR
# Define multiple secrets when applying a template
influx apply -o ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml \
  --secret=FOO=bar \
  --secret=BAZ=quzTo add a secret after applying a template, see Add secrets.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.