An InfluxDB v2 CLI profile stores the host URL, organization, and API token that influx uses for authenticated commands. Setting one active profile avoids repeating credentials on bucket, query, write, backup, and token commands.
Profiles are saved in the local influx configuration file, and one profile is active at a time. Command-line flags override environment variables, and environment variables override the saved profile, so clear temporary INFLUX_HOST, INFLUX_ORG, and INFLUX_TOKEN values when testing the profile itself.
Use a token with the permissions needed for profile-backed bucket, write, query, or task operations. Keep real tokens out of copied transcripts and rotate any token that was pasted into the wrong profile or shared shell history.
Steps to configure an InfluxDB v2 CLI profile:
- Check that the InfluxDB host answers before saving it in the profile.
$ influx ping --host https://influxdb.example.net OK
Use the URL that the CLI should reach from this terminal, including the scheme and port when the server is not on the default HTTPS port.
- Create the CLI profile and make it active.
$ influx config create --config-name production \ --host-url https://influxdb.example.net \ --org example-org \ --token <API_TOKEN> \ --active Active Name URL Org * production https://influxdb.example.net example-org
The profile stores the API token for later influx commands. Use a scoped token for routine work instead of an operator token when the profile only needs bucket, write, query, or task permissions.
Related: How to create a scoped InfluxDB v2 API token - List the saved CLI profiles.
$ influx config list Active Name URL Org default http://localhost:8086 example-org * production https://influxdb.example.net example-org
The asterisk marks the profile that commands use when no --host, --org, --token, or environment override is supplied.
- Clear temporary environment credential overrides before testing the saved profile.
$ unset INFLUX_HOST INFLUX_ORG INFLUX_TOKEN
Environment variables are useful for one-off sessions, but they can hide a wrong saved host, organization, or token during profile testing.
- Print the active profile.
$ influx config Active Name URL Org * production https://influxdb.example.net example-org
- Switch back to the profile by name when another profile becomes active.
$ influx config production Active Name URL Org * production https://influxdb.example.net example-org
Use influx config list first when multiple profiles exist and the active profile is unclear.
- Run an authenticated bucket check through the active profile.
$ influx bucket list ID Name Retention Shard group duration Organization ID Schema Type 327b7eacb96346ef _monitoring 168h0m0s 24h0m0s ab5dfdf265563657 implicit 7a613cb5a4368ae0 _tasks 72h0m0s 24h0m0s ab5dfdf265563657 implicit 765d5ab4a91311a9 example-bucket infinite 168h0m0s ab5dfdf265563657 implicit
A bucket table returned without host, organization, or token flags confirms that influx used the active saved profile.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.