Use the Flux VS Code extension

On this page

The Flux VS Code extension is available in the Visual Studio Marketplace. For information about installing extensions from the Visual Studio marketplace, see the .

Once installed, open the Explorer area of your VS Code user interface. A new InfluxDB pane is available below your file explorer.

Connect to InfluxDB

To create an InfluxDB connection in VS Code:

  1. Add an InfluxDB connection in VS Code

  2. Provide the required connection credentials:

    • Type: type of InfluxDB data source. Select InfluxDB v2.
    • Name: unique identifier for your InfluxDB connection.
    • Token: InfluxDB .
    • Organization: InfluxDB organization name.
  3. Click Test to test the connection.

  4. Once tested successfully, click Save.

  • To edit a connection, right click on the connection to edit and select Edit Connection.
  • To remove a connection, right click on the connection to remove and select Remove Connection.
  • To switch to a connection, right click on the connection to switch to and select Switch To This Connection.
  1. Write your Flux query in a new VS Code file.
  2. Save your Flux script with the extension or set the VS Code Language Mode to Flux.
  3. Execute the query with the influxdb.runQuery command or .

Explore your schema

After you’ve configured an InfluxDB connection, VS Code provides an overview of buckets, measurements, and tags in your InfluxDB organization. Use the InfluxDB pane in VS code to explore your schema.

To view errors returned from Flux script executions, click the Errors and Warnings icons in the bottom left of your VS Code window, and then select the Output tab in the debugging pane.

VS Code errors and warnings

Upgrade the Flux extension