Documentation

Create a bucket

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

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)

    The minimum retention period is one hour.

# Syntax
influx bucket create -n <BUCKET_NAME> -o <INFLUX_ORG> -r <RETENTION_PERIOD_DURATION>

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

Create a bucket with an explicit schema

By default, buckets have an implicit schema-type and a schema that conforms to your data. To require data to have specific columns and data types and prevent non-conforming write requests, create a bucket schema.

  1. influx bucket create \
           --name my_schema_bucket \
           --schema-type explicit
    
  2. Create a bucket schema. For more information, see Manage bucket schemas.

    influx bucket-schema create \
      --bucket my_schema_bucket \
      --name temperature \
      --columns-file schema.json
    

Create a bucket using the InfluxDB API

Use the InfluxDB API to create a bucket.

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.
API tokenUse the Authorization: Token header.

Example

The URL depends on your InfluxDB Cloud region (see InfluxDB URLs).

INFLUX_TOKEN=YOUR_API_TOKEN
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.


Was this page helpful?

Thank you for your feedback!


Select your region

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.

InfluxDB Cloud backed by InfluxDB IOx

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by IOx, this is the correct documentation.

If powered by TSM, see the TSM-based InfluxDB Cloud documentation.

InfluxDB Cloud backed by InfluxDB TSM

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine which enables nearly unlimited series cardinality and SQL query support. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by TSM, this is the correct documentation.

If powered by IOx, see the IOx-based InfluxDB Cloud documentation.

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.