Documentation

Create a bucket

Use the InfluxDB user interface (UI) or the influx command line interface (CLI) to create a bucket.

Bucket limits

A single InfluxDB 2.0 OSS instance supports approximately 20 buckets actively being written to or queried across all organizations depending on the use case. Any more than that can adversely affect performance.

Create a bucket in the InfluxDB UI

There are two places you can create a bucket in the UI.

Create a bucket from the Load Data menu

  1. In the navigation menu on the left, select Data (Load Data) > Buckets.

  2. Click Create Bucket in the upper right.

  3. Enter a Name for the bucket.

  4. Select when to Delete Data:

    • Never to retain data forever.
    • Older than to choose a specific retention period.
  5. Click Create to create the bucket.

Create a bucket in the Data Explorer

  1. In the navigation menu on the left, select *Explore (Data Explorer).

  2. In the From panel in the Flux Builder, select + Create Bucket.

  3. Enter a Name for the bucket.

  4. Select when to Delete Data:

    • Never to retain data forever.
    • Older than to choose a specific retention period.
  5. Click Create to create the bucket.

Create a bucket using the influx CLI

Use the influx bucket create command to create a new bucket. A bucket requires the following:

  • bucket name
  • organization name or ID
  • retention period (duration to keep data) in one of the following units:
    • nanoseconds (ns)
    • microseconds (us or µs)
    • milliseconds (ms)
    • seconds (s)
    • minutes (m)
    • hours (h)
    • days (d)
    • weeks (w)
# Syntax
influx bucket create -n <bucket-name> -o <org-name> -r <retention-period-duration>

# Example
influx bucket create -n my-bucket -o my-org -r 72h

Create a bucket using the InfluxDB API

Use the InfluxDB API to create a bucket.

Bucket limits

A single InfluxDB 2.0 OSS instance supports approximately 20 buckets actively being written to or queried across all organizations depending on the use case. Any more than that can adversely affect performance.

Create a bucket in InfluxDB using an HTTP request to the InfluxDB API /buckets endpoint. Use the POST request method and include the following in your request:

RequirementInclude by
OrganizationUse orgID in the JSON payload.
BucketUse name in the JSON payload.
Retention RulesUse retentionRules in the JSON payload.
Authentication tokenUse the Authorization: Token header.

Example

The URL depends on the version and location of your InfluxDB 2.0 instance (see InfluxDB URLs).

INFLUX_TOKEN=YourAuthToken
INFLUX_ORG_ID=your-org-id

curl --request POST \
	"http://localhost:8086/api/v2/buckets" \
	--header "Authorization: Token ${INFLUX_TOKEN}" \
  --header "Content-type: application/json" \
  --data '{
    "orgID": "'"${INFLUX_ORG_ID}"'",
    "name": "iot-center",
    "retentionRules": [
      {
        "type": "expire",
        "everySeconds": 86400,
        "shardGroupDurationSeconds": 0
      }
    ],
  }'

For information about InfluxDB API options and response codes, see InfluxDB API Buckets documentation.


Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.