Documentation

Write data from InfluxDB OSS to InfluxDB Cloud

To write data from InfluxDB OSS to InfluxDB Cloud, use the Flux to() or experimental.to() functions. Write data once with a single query execution or use InfluxDB tasks to routinely write data to InfluxDB Cloud.

Replicate writes to InfluxDB OSS to InfluxDB Cloud

To replicate all writes to an InfluxDB OSS instance to an InfluxDB Cloud instance, use InfluxDB replication streams.

InfluxDB Cloud rate limits

Write requests to InfluxDB Cloud are subject to the rate limits associated with your InfluxDB Cloud pricing plan.

  1. Query data from InfluxDB OSS.

  2. (Optional) Filter or process data to write to InfluxDB Cloud.

  3. Use to or experimental.to to write data to InfluxDB Cloud. For most use cases, to() is the correct function to use, but depending on the structure of the data you’re writing, experimental.to may be required.

    Use the following guidelines:

    • to(): Use to write data in field keys to the _field column and field values to the _value column.

    • experimental.to(): Use to write data in column names to corresponding field keys and column values to field values.

    See input and output examples for to() functions.

  4. Provide the following parameters to either function:

    • bucket: InfluxDB Cloud bucket to write to
    • host: InfluxDB Cloud region URL
    • org: InfluxDB Cloud organization
    • token: InfluxDB Cloud API Token
  5. (Recommended) To keep your raw API token out of queries, store your InfluxDB Cloud API token as an InfluxDB secret in your InfluxDB OSS instance and use secrets.get() to retrieve the secret value as shown in the following example (select the function you’re using to see the correct format):

import "influxdata/influxdb/secrets"

cloudToken = secrets.get(key: "INFLUX_CLOUD_API_TOKEN")

from(bucket: "example-oss-bucket")
    |> range(start: -10m)
    |> filter(fn: (r) => r._measurement == "example-measurement")
    |> to(
        bucket: "example-cloud-bucket",
        host: "https://cloud2.influxdata.com",
        org: "example-org",
        token: cloudToken,
    )
import "experimental"
import "influxdata/influxdb/secrets"

cloudToken = secrets.get(key: "INFLUX_CLOUD_API_TOKEN")

from(bucket: "example-oss-bucket")
    |> range(start: -10m)
    |> filter(fn: (r) => r._measurement == "example-measurement")
    |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
    |> experimental.to(
        bucket: "example-cloud-bucket",
        host: "https://cloud2.influxdata.com",
        org: "example-org",
        token: cloudToken,
    )

Input and output data for to() functions

  • to() requires _time, _measurement, _field, and _value columns.
  • to() writes all other columns as tags where the column name is the tag key and the column value is the tag value.

Input data

_time_measurementexampleTag_field_value
2021-01-01T00:00:00Zexample-mAtemp80.0
2021-01-01T00:01:00Zexample-mAtemp80.3
2021-01-01T00:02:00Zexample-mAtemp81.1
_time_measurementexampleTag_field_value
2021-01-01T00:00:00Zexample-mArpm4023
2021-01-01T00:01:00Zexample-mArpm4542
2021-01-01T00:02:00Zexample-mArpm4901

Output line protocol

example-m,exampleTag=A temp=80.0,rpm=4023i 1609459200000000000
example-m,exampleTag=A temp=80.3,rpm=4542i 1609459260000000000
example-m,exampleTag=A temp=81.1,rpm=4901i 1609459320000000000
  • experimental.to() requires _time and _measurement columns.
  • Columns in the group key (other than _measurement) are parsed as tags where the column name is the tag key and the column value is the tag value.
  • Columns not in the group key (other than _time_) are parsed as fields where the column name is the field key and the column value is the field value.

Input data

Group key = [_measurement, exampleTag]

_time_measurementexampleTagtemprpm
2021-01-01T00:00:00Zexample-mA80.04023
2021-01-01T00:01:00Zexample-mA80.34542
2021-01-01T00:02:00Zexample-mA81.14901

Output line protocol

example-m,exampleTag=A temp=80.0,rpm=4023i 1609459200000000000
example-m,exampleTag=A temp=80.3,rpm=4542i 1609459260000000000
example-m,exampleTag=A temp=81.1,rpm=4901i 1609459320000000000

Examples

Downsample and write data to InfluxDB Cloud

import "influxdata/influxdb/secrets"

cloudToken = secrets.get(key: "INFLUX_CLOUD_API_TOKEN")

from(bucket: "example-oss-bucket")
    |> range(start: -10m)
    |> filter(fn: (r) => r._measurement == "example-measurement")
    |> aggregateWindow(every: 1m, fn: last)
    |> to(
        bucket: "example-cloud-bucket",
        host: "https://cloud2.influxdata.com",
        org: "example-org",
        token: cloudToken,
    )

Write min, max, and mean values to InfluxDB Cloud

import "influxdata/influxdb/secrets"

cloudToken = secrets.get(key: "INFLUX_CLOUD_API_TOKEN")

data = from(bucket: "example-oss-bucket")
    |> range(start: -30m)
    |> filter(fn: (r) => r._measurement == "example-measurement")

min = data |> aggregateWindow(every: 10m, fn: min) |> map(fn: (r) => ({ r with _field: "{$r._field}_min" }))
max = data |> aggregateWindow(every: 10m, fn: max) |> map(fn: (r) => ({ r with _field: "{$r._field}_max" }))
mean = data |> aggregateWindow(every: 10m, fn: mean) |> map(fn: (r) => ({ r with _field: "{$r._field}_mean" }))

union(tables: [min, max, mean])
    |> to(
        bucket: "example-cloud-bucket",
        host: "https://cloud2.influxdata.com",
        org: "example-org",
        token: cloudToken,
    )

Automate writing data from InfluxDB OSS to InfluxDB Cloud

To automatically and routinely write data from InfluxDB OSS to InfluxDB Cloud, create a task in your InfluxDB OSS instance that regularly queries, processes, and writes data to InfluxDB Cloud.

import "influxdata/influxdb/tasks"

option task = {name: "Downsample to InfluxDB Cloud", every: 1h}

from(bucket: "example-oss-bucket")
    |> range(start: -10m)
    |> filter(fn: (r) => r._measurement == "example-measurement")
    |> aggregateWindow(every: 1m, fn: last)
    |> to(
        bucket: "example-cloud-bucket",
        host: "https://cloud2.influxdata.com",
        org: "example-org",
        token: cloudToken,
    )

Was this page helpful?

Thank you for your feedback!


InfluxDB OSS 2.9.0: API tokens are hashed by default

Stronger token security in InfluxDB OSS 2.9.0 — tokens are hashed on disk by default. Existing tokens are hashed on first startup and can’t be recovered afterward. Capture any plaintext tokens you still need before you upgrade.

View InfluxDB OSS 2.9.0 release notes

Hashed tokens authenticate exactly like unhashed tokens — clients and integrations keep working.

Also new in 2.9.0:

  • Configurable backup compression
  • Restore support for backups containing hashed tokens
  • Tighter Edge Data Replication queue validation
  • Flux upgrade
  • Compaction reliability improvements

Key enhancements in Explorer 1.8

Explorer 1.8 is now available with streaming data subscriptions (beta), line protocol preview, and query history & saved queries.

View Explorer 1.8 release notes

Explorer 1.8 includes new features and improvements that make it easier to ingest, explore, and manage data.

Highlights:

  • Streaming data subscriptions (beta): Stream data into Explorer from MQTT, Kafka, and AMQP sources.
  • Line protocol preview: Preview line protocol, schema, and parse errors before data is written.
  • Custom sample data: Generate custom sample datasets with line protocol and schema preview.
  • Query history and saved queries: Browse query history and save/re-run named queries.
  • Retention period management: Set, update, or clear retention periods on databases and tables.

For more details, see Explorer 1.8 release notes

InfluxDB 3.9: Performance upgrade preview

InfluxDB 3 Enterprise 3.9 includes a beta of major performance upgrades with faster single-series queries, wide-and-sparse table support, and more.

InfluxDB 3 Enterprise 3.9 includes a beta of major performance and feature updates.

Key improvements:

  • Faster single-series queries
  • Consistent resource usage
  • Wide-and-sparse table support
  • Automatic distinct value caches for reduced latency with metadata queries

Preview features are subject to breaking changes.

For more information, see:

Telegraf Enterprise now in public beta

Get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

See the Blog Post

The upcoming Telegraf Enterprise offering is for organizations running Telegraf at scale and is comprised of two key components:

  • Telegraf Controller: A control plane (UI + API) that centralizes Telegraf configuration management and agent health visibility.
  • Telegraf Enterprise Support: Official support for Telegraf Controller and Telegraf plugins.

Join the Telegraf Enterprise beta to get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

For more information:

Telegraf Controller v0.0.7-beta now available

Telegraf Controller v0.0.7-beta is now available with new features, improvements, bug fixes, and an important breaking change.

View the release notes
Download Telegraf Controller v0.0.7-beta

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On May 27, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2

InfluxDB Cloud powered by TSM