---
title: "Buckets"
description: "How to create, list, and delete Edge Network storage buckets via console, CLI, or SDK, plus naming rules, lifecycle expiry rules, and public bucket access."
url: "https://edge.network/docs/storage/buckets"
section: "Storage"
---

# Buckets

Buckets are containers for your objects. Each bucket has a unique name within your account.

![Storage buckets list in Control](/media/docs/control-storage-buckets.svg)

## Bucket naming rules

- 3–63 characters long
- Lowercase letters, numbers and hyphens only
- Must start and end with a letter or number
- Cannot contain consecutive hyphens
- Unique within your account

## Create a bucket

In the console, navigate to [Storage → Buckets](/console/storage) and click **Create Bucket**. Enter a name and click create.

To create a bucket from the command line or your code, use the AWS CLI or the SDK:

```bash tab="AWS CLI"
aws --profile edge --endpoint-url https://storage.edge.network \
    s3 mb s3://my-new-bucket
```

```js tab="JavaScript SDK"
import { S3Client, CreateBucketCommand } from '@aws-sdk/client-s3'

const client = new S3Client({
  endpoint: 'https://storage.edge.network',
  region: 'us-east-1',
  forcePathStyle: true,
  credentials: {
    accessKeyId: 'YOUR_ACCESS_KEY',
    secretAccessKey: 'YOUR_SECRET_KEY'
  }
})

await client.send(new CreateBucketCommand({
  Bucket: 'my-new-bucket'
}))
```

## List buckets

```bash
aws --profile edge --endpoint-url https://storage.edge.network s3 ls
```

```text
2025-01-15 09:00:00 assets
2025-02-01 14:30:00 backups
2025-02-10 11:15:00 uploads
```

## Delete a bucket

A bucket must be empty before it can be deleted. Empty it first, then delete it:

```bash
# Delete all objects first
aws --profile edge --endpoint-url https://storage.edge.network \
    s3 rm s3://my-bucket --recursive

# Then delete the bucket
aws --profile edge --endpoint-url https://storage.edge.network \
    s3 rb s3://my-bucket
```

> [!WARNING]
> Bucket deletion is permanent and cannot be undone.

## Bucket statistics

Each bucket tracks storage usage automatically:

| Metric | Description |
|---|---|
| `storage_bytes` | Total size of all objects in bytes |
| `object_count` | Number of objects in the bucket |
| `created_at` | When the bucket was created |

## Lifecycle rules

Lifecycle rules automatically delete objects older than a specified number of days. Useful for temporary uploads, log files, build artefacts and session data.

### Creating a rule

1. Open a bucket and navigate to **Settings**.
2. Click **Add Rule**.
3. Set the number of days after which objects should be deleted.
4. Optionally set a **prefix filter** to only target objects with a specific path prefix (for example `logs/` or `tmp/`).

### How it works

Rules are evaluated hourly. Objects whose last modified time exceeds the expiry threshold are deleted automatically.

Prefix filters let you target specific folders. A rule with prefix `logs/` only deletes objects under that path.

You can have multiple rules per bucket. For example: delete `tmp/` after 1 day and `logs/` after 30 days.

### Lifecycle API

- `GET /api/storage/buckets/:name/lifecycle`: list rules for a bucket.
- `POST /api/storage/buckets/:name/lifecycle`: create a rule, for example `{ "expire_days": 30, "prefix": "logs/" }`.
- `DELETE /api/storage/buckets/:name/lifecycle/:ruleId`: delete a rule.

## Public buckets

Buckets can be made public, allowing anyone to access objects via a direct URL without authentication.

### Enabling public access

1. Open a bucket and navigate to **Settings**.
2. Click **Make Public**.
3. Copy the public base URL.

Objects are then accessible at:

```text
https://storage.edge.network/_public/{customerId}/{bucket}/{object-key}
```

- **Public:** GET and HEAD requests require no authentication. CORS headers are included for browser access.
- **Private (default):** all requests require S3 authentication or a presigned URL. This is the default for all new buckets.

> [!NOTE]
> **CDN recommended for production.** For production public content, consider using Edge CDN with a storage bucket origin instead. CDN provides caching, DDoS protection and global edge delivery on top of public access.

### Public access API

- `PATCH /api/storage/buckets/:name/public`: toggle public access, for example `{ "is_public": true }`.
