---
title: "CDN commands"
description: "Edge CLI CDN command reference: create deployments, add custom domains with URL or storage origins, purge cached paths, and view traffic and cache metrics."
url: "https://edge.network/docs/cli/cdn"
section: "CLI"
---

# CDN commands

Create deployments, manage domains, and purge cache from your terminal.

## Deployments

### List deployments

```text
$ edge cdn list
ID              NAME           DOMAINS    STATUS    CREATED
cdn-abc123      production     3          active    2025-01-15
cdn-def456      staging        1          active    2025-02-01
cdn-ghi789      legacy         2          active    2024-12-10
```

### Create a deployment

```text
$ edge cdn create --name my-cdn

Creating CDN deployment... done

ID:      cdn-jkl012
Name:    my-cdn
Status:  active

Add a domain to start using your CDN:
  edge cdn domains add cdn-jkl012 --domain cdn.example.com --origin https://origin.example.com
```

### Get deployment details

```text
$ edge cdn get cdn-abc123
ID:           cdn-abc123
Name:         production
Status:       active
Created:      2025-01-15 10:30:00 UTC

Domains:
  cdn.example.com       → https://origin.example.com     SSL: active
  assets.example.com    → storage://my-bucket            SSL: active
  static.example.com    → https://s3.amazonaws.com/...   SSL: active

Statistics (24h):
  Requests:      1,245,678
  Bandwidth:     45.2 GB
  Cache Hit:     94.5%
```

### Delete a deployment

```bash
# Delete with confirmation
edge cdn delete cdn-abc123

# Delete without confirmation
edge cdn delete cdn-abc123 --yes
```

## Domains

### List domains

```text
$ edge cdn domains list cdn-abc123
DOMAIN                ORIGIN                           SSL       CACHE TTL
cdn.example.com       https://origin.example.com       active    86400s
assets.example.com    storage://my-assets              active    604800s
static.example.com    https://s3.amazonaws.com/...     active    2592000s
```

### Add a domain

```bash
# Add domain with external origin
edge cdn domains add cdn-abc123 \
    --domain cdn.example.com \
    --origin https://origin.example.com \
    --cache-ttl 86400

# Add domain with Storage bucket as origin
edge cdn domains add cdn-abc123 \
    --domain assets.example.com \
    --origin-type storage \
    --storage-bucket my-assets

# Enable JIT image optimization
edge cdn domains add cdn-abc123 \
    --domain images.example.com \
    --origin https://origin.example.com \
    --jit-image
```

### Update a domain

```bash
# Update origin
edge cdn domains update cdn-abc123 dom-xyz789 \
    --origin https://new-origin.example.com

# Update cache TTL
edge cdn domains update cdn-abc123 dom-xyz789 \
    --cache-ttl 3600
```

### Remove a domain

```bash
edge cdn domains remove cdn-abc123 dom-xyz789
```

## Cache purging

### Purge all

```text
$ edge cdn purge cdn-abc123
Purging all cached content... done

Cache cleared for all domains in cdn-abc123
```

### Selective purge

```bash
# Purge specific path
edge cdn purge cdn-abc123 --path /images/*

# Purge specific URL
edge cdn purge cdn-abc123 --url https://cdn.example.com/asset.js

# Purge multiple paths
edge cdn purge cdn-abc123 --path /css/* --path /js/*
```

## Metrics

```text
$ edge cdn metrics cdn-abc123
Period: Last 24 hours

Total Requests:     1,245,678
Bandwidth:          45.2 GB
Cache Hit Rate:     94.5%
Cache Misses:       68,412

By Domain:
  cdn.example.com       892,345 requests    32.1 GB
  assets.example.com    312,456 requests    10.8 GB
  static.example.com     40,877 requests     2.3 GB
```

```bash
# Specify time period
edge cdn metrics cdn-abc123 --period 7d

# Filter by domain
edge cdn metrics cdn-abc123 --domain cdn.example.com

# Export as CSV
edge cdn metrics cdn-abc123 --export csv > cdn-metrics.csv
```

## Common flags

| Flag | Description |
|---|---|
| `--name`, `-n` | Deployment name |
| `--domain` | Domain hostname |
| `--origin` | Origin URL |
| `--origin-type` | Origin type: `url` or `storage` |
| `--storage-bucket` | Storage bucket name (when `--origin-type` is `storage`) |
| `--cache-ttl` | Cache TTL in seconds |
| `--jit-image` | Enable JIT image optimisation |
| `--path` | Path pattern to purge |
| `--url` | Specific URL to purge |
| `--yes`, `-y` | Skip confirmation prompts |

## Next steps

- [DNS commands](/docs/cli/dns) — Manage zones and records
- [CDN docs](/docs/cdn) — Full CDN documentation
