---
title: "CLI DNS Commands"
description: "Manage DNS zones and records from the command line."
url: https://edge.network/docs/cli/dns/
---

# CLI DNS Commands

CLI

# DNS Commands

Manage DNS zones and records, including geographic routing.

## Zones

### List Zones

```
$ edge dns list
ID              DOMAIN              RECORDS    STATUS    CREATED
zone-abc123     example.com         24         active    2025-01-15
zone-def456     example.org         12         active    2025-02-01
zone-ghi789     mysite.io           8          active    2025-02-10
```

### Create a Zone

```
$ edge dns create --domain example.com

Creating zone... done

ID:           zone-jkl012
Domain:       example.com
Status:       active
Nameservers:  ns1.edge.network, ns2.edge.network

Update your domain's nameservers at your registrar to activate DNS.
```

### Get Zone Details

```
$ edge dns get zone-abc123
ID:           zone-abc123
Domain:       example.com
Status:       active
Created:      2025-01-15 10:30:00 UTC
Nameservers:  ns1.edge.network, ns2.edge.network

Records:      24
  A:          8
  AAAA:       4
  CNAME:      6
  MX:         2
  TXT:        4

Queries (24h): 1,245,678
```

### Delete a Zone

```
# Delete with confirmation
edge dns delete zone-abc123

# Delete without confirmation
edge dns delete zone-abc123 --yes
```

## Import & Export

### Export Zone

```
# Export as JSON
edge dns export zone-abc123

# Export as BIND zone file
edge dns export zone-abc123 --format bind > example.com.zone

# Export as JSON to file
edge dns export zone-abc123 > example.com.json
```

### Import Zone

```
# Import from JSON file
edge dns import zone-abc123 --file records.json

# Import from BIND zone file
edge dns import zone-abc123 --file example.com.zone --format bind
```

## Records

### List Records

```
$ edge dns records list zone-abc123
TYPE    NAME      DATA                           TTL     GEO
A       @         192.0.2.1                      300     -
A       @         192.0.2.2                      300     EU
A       www       192.0.2.1                      300     -
AAAA    @         2001:db8::1                    300     -
CNAME   cdn       cdn.edge.network.              300     -
MX      @         mail.example.com.              3600    -
TXT     @         "v=spf1 include:_spf..."       3600    -
```

### Add Records

```
# Add an A record
edge dns records add zone-abc123 --type A --name www --data 192.0.2.1 --ttl 300

# Add a CNAME record
edge dns records add zone-abc123 --type CNAME --name cdn --data cdn.edge.network

# Add an MX record
edge dns records add zone-abc123 --type MX --name @ --data mail.example.com --priority 10

# Add a TXT record
edge dns records add zone-abc123 --type TXT --name @ --data "v=spf1 include:_spf.example.com ~all"
```

### Geographic Routing

```
# Add record with geo routing
edge dns records add zone-abc123 --type A --name @ --data 185.1.1.1 \
    --geo EU=185.2.2.2 \
    --geo NA=185.3.3.3 \
    --geo US-WEST=185.4.4.4 \
    --geo GB=185.5.5.5

# Geo codes follow this hierarchy:
#   Region:  NA, EU, AS, OC, AF, ME, SA
#   Country: US, GB, DE, FR, JP, etc. (ISO 3166-1)
#   Zone:    US-WEST, US-EAST, CN-NORTH, etc.
```

### Update a Record

```
# Update record data
edge dns records update zone-abc123 rec-xyz789 --data 192.0.2.2

# Update TTL
edge dns records update zone-abc123 rec-xyz789 --ttl 600

# Update multiple fields
edge dns records update zone-abc123 rec-xyz789 --data 192.0.2.2 --ttl 600
```

### Delete a Record

```
# Delete with confirmation
edge dns records delete zone-abc123 rec-xyz789

# Delete without confirmation
edge dns records delete zone-abc123 rec-xyz789 --yes
```

## Metrics

```
$ edge dns metrics zone-abc123
Period: Last 24 hours

Total Queries:      1,245,678
Response Time:      2.3ms avg

By Record Type:
  A:       892,345 queries
  AAAA:    201,456 queries
  CNAME:   112,345 queries
  MX:       32,456 queries
  TXT:       7,076 queries

By Country:
  United States:    456,789
  United Kingdom:   234,567
  Germany:          178,234
  France:            89,012
  Other:            287,076

# Specify time period
edge dns metrics zone-abc123 --period 7d

# Filter by record type
edge dns metrics zone-abc123 --record-type A

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

## Supported Record Types

| Type | Description | Geo Support |
| A | IPv4 address |
| AAAA | IPv6 address |
| CNAME | Canonical name (alias) |
| MX | Mail exchange |
| TXT | Text record |
| NS | Nameserver |
| CAA | Certificate Authority Authorization |
| SRV | Service record |

## DNS Examiner

Run AI-powered analysis of your DNS configuration. Checks email deliverability, security, nameserver delegation, and best practices.

```
# Run examination on a zone
edge dns examine <zone-id>

# View the last examination result
edge dns examine-last <zone-id>

# Output as JSON
edge dns examine <zone-id> --output json
```

Examinations take up to 30 seconds. Results are saved and can be retrieved with `examine-last`.

## Common Flags

| Flag | Description |
| --domain | Domain name for zone |
| --type | Record type (A, AAAA, CNAME, etc.) |
| --name | Record name (@ for root) |
| --data | Record value/data |
| --ttl | Time to live in seconds |
| --priority | Priority for MX records |
| --geo | Geographic routing (CODE=value) |
| --format | Import/export format (json, bind) |

## See Also

[Storage Commands Manage buckets and objects](https://edge.network/docs/cli/storage) [DNS Docs Full DNS documentation](https://edge.network/docs/dns)
[Back to Docs](https://edge.network/docs) [Need help?](https://edge.network/support)
