Azion CLI dns-zone
Azion CLI commands that create, list, describe, update, and delete Edge DNS zones, with every flag, its type, and its default.
The Azion CLI dns-zone commands create, list, describe, update, and delete zones, the Edge DNS object that holds one domain and its records. The fields of a zone, their bounds, and the errors the API returns are on Zones and records. The options every command accepts, such as --format, --out, and -y, are on Global options.
Create
azion create dns-zone creates a zone for the domain you pass:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--active | — | — | true | Turns the zone on (--active=true) or off (--active=false). |
--domain | — | string | — | Required unless --file is set. Domain the zone serves. Without it, the command asks for the domain. |
--file | — | string | — | Path to a JSON file with the attributes of the zone. Use - to read the JSON from standard input. |
--name | — | string | — | Name of the zone. |
This command creates a zone named my-zone for the domain my-domain.com:
The command prints the ID of the zone:
A domain that another account hosts is refused with ["Domain Belongs to Another Account."], and a domain that already has a zone in your account is refused with ["This field must be unique."]. Both errors are explained on Zones and records.
List
azion list dns-zone lists the zones of your account, 50 to a page:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--details | — | — | — | Accepted, and prints the same ID, NAME, DOMAIN, and ACTIVE columns as the plain list. |
--filter | — | string | — | Name to filter the list by. |
--order-by | — | string | — | Field to sort the list by. |
--page | — | int | 1 | Number of the page to return. |
--page-size | — | int | 50 | Number of zones on each page. |
This command lists every zone of the account:
The command prints one row per zone, with its domain and its state:
Describe
azion describe dns-zone prints the settings of one zone:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--zone-id | — | int | — | Required. ID of the zone to describe. |
This command describes the zone with ID 1235:
The command prints the zone and the Azion nameservers that answer for its domain:
With --format json, the command prints the same object with the keys active, domain, id, name, nameservers, and product_version.
Update
azion update dns-zone changes the name or the active state of a zone. The command has no flag for the domain:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--active | — | — | true | Turns the zone on (--active=true) or off (--active=false). |
--file | — | string | — | Path to a JSON file with the attributes to change. Use - to read the JSON from standard input. |
--name | — | string | — | New name of the zone. |
--zone-id | — | int | — | Required. ID of the zone to update. |
Write --active with an equals sign. With a space, --active false prints DNS zone 1234 was updated and leaves the zone active.
This command turns off the zone with ID 1234:
The command confirms the update:
Delete
azion delete dns-zone deletes a zone:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--zone-id | — | int | — | Required. ID of the zone to delete. |
This command deletes the zone with ID 1235:
The command confirms the deletion:
Use a JSON file
azion create dns-zone and azion update dns-zone read the attributes of the zone from a JSON file with --file.
This file creates a zone named my-file-zone for my-file-domain.com and keeps it turned off. The command reads name, domain, and active from it:
Pass the file to the create command:
The command prints the ID of the zone:
On update, pass the ID of the zone with --zone-id. This file renames the zone and turns it on:
Pass the file to the update command:
The command confirms the update: