Documentation

Set up InfluxDB

As you get started with this tutorial, do the following to make sure everything you need is in place.

  1. (Optional) Download, install, and configure the influx CLI.

    The influx CLI provides a simple way to interact with InfluxDB from a command line. For detailed installation and setup instructions, see Use the influx CLI.

  2. Create an All Access API token.

    1. Go to cloud2.influxdata.com in a browser to log in and access the InfluxDB UI.

    2. Navigate to Load Data > API Tokens using the left navigation bar.

    3. Click + Generate API token and select All Access API Token.

    4. Enter a description for the API token and click Save.

    5. Copy the generated token and store it for safe keeping.

    We recommend using a password manager or a secret store to securely store sensitive tokens.

  3. Configure authentication credentials.

    As you go through this tutorial, interactions with InfluxDB Cloud require your InfluxDB host, organization name or ID, and your API token. There are different methods for providing these credentials depending on which client you use to interact with InfluxDB.

    When configuring your token, if you created an all access token, use that token to interact with InfluxDB. Otherwise, use your operator token.

    When managing InfluxDB Cloud through the InfluxDB UI, authentication credentials are provided automatically using credentials associated with the user you log in with.

    There are three ways to provided authentication credentials to the influx CLI:

    CLI connection configurations (Recommended)

    Environment variables

    Command flags

    All influx CLI examples in this getting started tutorial assume your InfluxDB host, organization, and token are provided by either the active influx CLI configuration or by environment variables.

    When using the InfluxDB API, provide the required connection credentials in the following ways:

    • InfluxDB host: InfluxDB Cloud region URL
    • InfluxDB API Token: Include an Authorization header that uses either Bearer or Token scheme and your InfluxDB API token. For example:
      Authorization: Bearer 0xxx0o0XxXxx00Xxxx000xXXxoo0==.
    • InfluxDB organization name or ID: Depending on the API endpoint used, pass this as part of the URL path, query string, or in the request body.

    All API examples in this tutorial use cURL from a command line. To provide all the necessary credentials to the example cURL commands, set the following environment variables in your command line session.

    export INFLUX_HOST=https://cloud2.influxdata.com
    export INFLUX_ORG=<YOUR_INFLUXDB_ORG_NAME>
    export INFLUX_ORG_ID=<YOUR_INFLUXDB_ORG_ID>
    export INFLUX_TOKEN=<YOUR_INFLUXDB_API_TOKEN>
    
  4. (Optional) Create a bucket.

    You can use an existing bucket or create a new one specifically for this getting started tutorial. All examples in this tutorial assume a bucket named “get-started”.

    Use the InfluxDB UI, influx CLI, or InfluxDB API to create a bucket.

    1. Go to cloud2.influxdata.com in a browser to log in and access the InfluxDB UI.

    2. Navigate to Load Data > Buckets using the left navigation bar.

    3. Click + Create bucket.

    4. Provide a bucket name (get-started) and select a retention period. Supported retention periods depend on your InfluxDB Cloud plan.

    5. Click Create.

    1. If you haven’t already, download, install, and configure the influx CLI.

    2. Use the influx bucket create command to create a new bucket.

      Provide the following:

      • -n, --name flag with the bucket name.
      • -r, --retention flag with the bucket’s retention period duration. Supported retention periods depend on your InfluxDB Cloud plan.
      • Connection and authentication credentials
      influx bucket create \
        --name get-started \
        --retention 7d
      

    To create a bucket using the InfluxDB HTTP API, send a request to the InfluxDB API /api/v2/buckets endpoint using the POST request method.

    POST https://cloud2.influxdata.com/api/v2/buckets
    

    Include the following with your request:

    • Headers:
      • Authorization: Token INFLUX_TOKEN
      • Content-Type: application/json
    • Request body: JSON object with the following properties:
      • org: InfluxDB organization name
      • name: Bucket name
      • retentionRules: List of retention rule objects that define the bucket’s retention period. Each retention rule object has the following properties:
        • type: "expire"
        • everySeconds: Retention period duration in seconds. Supported retention periods depend on your InfluxDB Cloud plan.
    export INFLUX_HOST=https://cloud2.influxdata.com
    export INFLUX_ORG_ID=<YOUR_INFLUXDB_ORG_ID>
    export INFLUX_TOKEN=<YOUR_INFLUXDB_API_TOKEN>
    
    curl --request POST \
    "$INFLUX_HOST/api/v2/buckets" \
      --header "Authorization: Token $INFLUX_TOKEN" \
      --header "Content-Type: application/json" \
      --data '{
        "orgID": "'"$INFLUX_ORG_ID"'",
        "name": "get-started",
        "retentionRules": [
          {
            "type": "expire",
            "everySeconds": 604800
          }
        ]
      }'
    

Was this page helpful?

Thank you for your feedback!


Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.

InfluxDB Cloud powered by IOx