# How to migrate nameservers to Azion

import Tabs from '~/components/tabs/Tabs'
import Code from '~/components/Code/Code.astro'

Azion allows you to host and manage DNS zones and records by redirecting the DNS resolution of your domain provider to Azion's authoritative nameservers (NS) through [Edge DNS](/en/documentation/products/secure/edge-dns/).

:::caution[warning]
If **Edge DNS** is activated, hosted zones and queries could generate usage-related costs. Check the [pricing page](/en/documentation/products/pricing/) for more information.
:::

---

## Step 1: Create a DNS zone

To create a DNS zone for a domain entry `yourdomain.org`:

<Tabs client:visible>
    <Fragment slot="tab.console">Console</Fragment>
    <Fragment slot="tab.api">API</Fragment>

<Fragment slot="panel.console">

1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Edge DNS**.
2. Click the **+ Zone** button.
3. Give your zone an easy-to-remember name.
4. Indicate the FQDN as recorded in the DNS. Example: `yourdomain.org`.
5. Click the **Save** button.

To get the Azion nameservers:

6. Click the **Copy Nameserver Values** button to get the Azion's nameservers: 

- `ns1.aziondns.net`
- `ns2.aziondns.com`
- `ns3.aziondns.org`

7. Keep these values in hand for when you [redirect the authoritative nameservers of your domain](#step-2-redirect-authoritative-nameservers).
</Fragment>

<Fragment slot="panel.api">

1. Run the following `POST` request in your terminal, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/) and adding your domain address in the `domain` field:

<Code lang="bash" code={`
curl --request POST \
  --url https://api.azion.com/v4/edge_dns/zones \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "MY dns Zone",
  "domain": "yourdomain.com",
  "active": true
}'
`} />

  | Key | Description |
  | --- | --- |
  | `name` | Sets the string in the value as a name of the zone entry with Azion. |
  | `domain` | Sets the apex domain. |
  | `active` | When `true`, activates the zone. |

2. You'll receive a response similar to this:

<Code lang="json" code={`
{
    "results": [
        {
            "nx_ttl": 3600,
            "domain": "yourdomain.com",
            "retry": 7200,
            "name": "yourdomain.com",
            "nameservers": [
                "ns1.aziondns.net",
                "ns2.aziondns.com",
                "ns3.aziondns.org"
            ],
            "soa_ttl": 3600,
            "is_active": true,
            "refresh": 43200,
            "expiry": 1209600,
            "id": <hosted_zone_id>
        }
    ]
}
`} />

1. Copy the values inside the `nameservers` field. These values will be used to [redirect the authoritative nameservers of your domain](#step-2-redirect-authoritative-nameservers).
2. Copy the `id` value for when you [associate an application to your zone](#step-3-create-edge-application-record-in-dns-zone).
</Fragment>

</Tabs>

---

## Step 2: Redirect authoritative nameservers

The next step is to redirect your domain's authoritative nameservers, and for this, you'll need to access your domain provider and modify your NS records. Here are some of the most popular domain providers and how they handle DNS nameserver changes:

- [AWS Route53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-name-servers-glue-records.html)
- [GoDaddy](https://www.godaddy.com/help/edit-my-domain-nameservers-664)
- [Namecheap](https://www.namecheap.com/support/knowledgebase/article.aspx/9434/10/using-default-nameservers-vs-hosting-nameservers/)

Azion recommends that you add all of the three available Azion nameservers for additional reliability: 

- `ns1.aziondns.net`
- `ns2.aziondns.com`
- `ns3.aziondns.org`

Once your nameserver records have been updated to Azion's addresses, you'll be able to create records directly from Azion. See the next section for an example on how to do that.

---

## Step 3: Create application record in DNS zone

After you've successfully migrated your DNS zone to Azion, you won't need to access your domain provider to create new records, since you can do that directly with Azion. This means you can launch your application with it's custom domain and easily create new applications and records as needed. 

To associate a new application to your domain, you'll need to create a new CNAME record in your zone and associate it to an application.

To customize the domain of your application under your new zone, you need to associate the CNAME of your application to a new record. Retrieve the custom domains listed for the application by following the steps:

<Tabs client:visible>
    <Fragment slot="tab.consoleworkloads">Console - Workloads</Fragment>
    <Fragment slot="tab.consoledomain">Console - Domains</Fragment>
    <Fragment slot="tab.apiv4">API v4</Fragment>
    <Fragment slot="tab.apiv3">API v3</Fragment>

<Fragment slot="panel.consoleworkloads">

1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Workloads**.
2. Click the domain you want to associate your custom domain to.
3. In the **Subdomain** and **Domain** fields, add the custom domains for the application that should be under your DNS zone. If you already added a custom domain, copy those values and keep them in hand.

Now you'll need to navigate to the **Edge DNS** area to add a record for your application's CNAMEs:

4. On the upper-left corner of the page, open the **Products menu**, represented by three horizontal lines, and then select **Edge DNS**.
5. Select the DNS zone.
6. Navigate to the **Records** tab.
7. Click the **+ Record** button.
8. Under **Name**, use a hostname or subdomain. For example: `*`.
9. Under **Record Type**, select `CNAME - Canonical name`.
10. Under **Value**, enter the Azion domain address in FQDN format. Example: `xxxxxxxxxx.map.azionedge.net`.
11. Set the **TTL** and **Policy** as desired.
12. Click the **Save** button.

Repeat the process described above for every CNAME listed for your application. Wait a couple of minutes for the changes to propagate. You can [run the DIG command](/en/documentation/products/guides/run-the-dig-command/) in your terminal to check whether your domain points to the Azion address.

</Fragment>

<Fragment slot="panel.consoledomain">

1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Domains**.
2. Click the domain you want to associate your custom domain to.
3. In the **CNAME** field, add the custom domains for the application that should be under your DNS zone. If you already added a custom domain, copy those values and keep them in hand.

Now you'll need to navigate to the **Edge DNS** area to add a record for your application's CNAMEs:

4. On the upper-left corner of the page, open the **Products menu**, represented by three horizontal lines, and then select **Edge DNS**.
5. Select the DNS zone.
6. Navigate to the **Records** tab.
7. Click the **+ Record** button.
8. Under **Name**, use a hostname or subdomain. For example: `*`.
9. Under **Record Type**, select `CNAME - Canonical name`.
10. Under **Value**, enter the Azion domain address in FQDN format. Example: `xxxxxxxxxx.map.azionedge.net`.
11. Set the **TTL** and **Policy** as desired.
12. Click the **Save** button.

Repeat the process described above for every CNAME listed for your application. Wait a couple of minutes for the changes to propagate. You can [run the DIG command](/en/documentation/products/guides/run-the-dig-command/) in your terminal to check whether your domain points to the Azion address.

</Fragment>

<Fragment slot="panel.apiv4">

1. Run the following `GET` request to retrieve your workloads's ID, replacing `TOKEN VALUE` with your [personal token](/en/documentation/products/guides/personal-tokens/):

<Code lang="bash" code={`
curl --request GET \
  --url https://api.azion.com/v4/workspace/workloads \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]'
`} />

2. You'll receive a response similar to this:

<Code lang="json" code={`
{
  "count": 3,
  "results": [
    {
      "id": "<workload_id>"",
      "name": "My workload",
      "active": true,
      "last_editor": "your-email.example.com",
      "last_modified": "2025-08-06T17:53:47.460211Z",
      "infrastructure": 1,
      "tls": {
        "certificate": null,
        "ciphers": 7,
        "minimum_version": "tls_1_3"
      },
      "protocols": {
        "http": {
          "versions": [
            "http1",
            "http2"
          ],
          "http_ports": [
            80
          ],
          "https_ports": [
            443
          ],
          "quic_ports": null
        }
      },
      "mtls": {
        "verification": null,
        "certificate": null,
        "crl": null
      },
      "domains": [
        "xxxxxxx.azion.app"
      ],
      "workload_domain_allow_access": false,
      "workload_domain": "xxxxxxxx.map.azionedge.net",
      "product_version": "1.0"
    },
`} /> 

3. Locate the domain you wish to link to the custom domain and copy the `domain_id` value received in the response.
4. If you have no CNAMEs listed, run a `PATCH` request, adding the `domain_id` as a path, to update the `cnames` field with the domains you wish to configure:

<Code lang="bash" code={`
curl --request PATCH \
  --url https://api.azion.com/v4/workspace/workloads/<workload_id> \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]' \
  --header 'Content-Type: application/json' \
  --data '{
    "domains": [
      "yourdomain.com",
      "*.yourdomain.com"
    ]
  }'
`} />
  | Key | Description |
  | --- | --- |
  | `domains` | Accepts a list of CNAMEs for the domains as values. For example, `["*.yourdomain.com", "blog.yourdomain.com"]`. |

:::tip
Add a wildcard (`*`) subdomain instead of a specific subdomain to cover all possible scenarios. This way, you won't need to create multiple records for `www.yourdomain.com` and `blog.yourdomain.com` if they point to the same application.
:::

5. Run a new `GET` request to retrieve the `hosted_zone_id`, which indicates [the DNS zone you created](#step-1-create-a-dns-zone):

<Code lang="json" code={`
{
    ...
    "results": [
        {
            "domain": "yourdomain.com - zone",
            "is_active": true,
            "name": "yourdomain.com",
            "id": <hosted_zone_id>
        }
    ]
}
`} />

6. Run the following `POST` request in your terminal, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/), `hosted_zone_id` with the value from the previous response and the answer's list with the Azion domain address as a string:

<Code lang="bash" code={`
curl --request POST \
  --url https://api.azion.com/v4/edge_dns/zones/<hosted_zone_id>/records \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]' \
  --header 'Content-Type: application/json' \
  --data '{
    "type": "CNAME",
    "name": "www",
    "rdata": ["xxxxxxxxxx.map.azionedge.net"],
    "ttl": 20,
    "description": "www record"
  }'
`} />

  | Key | Description |
  | --- | --- |
  | `record_type` | The type of record being created. See a full list of accepted record types in the [Edge DNS documentation](/en/documentation/products/secure/edge-dns/). |
  | `entry` | Sets the value of the entry, appending it to the apex domain from the zone to generate the record. For example, the value `www` will represent a record for `www.yourdomain.com`. Accepts the wildcard (`*`) notation. |
  | `rdata` | Accepts a list of CNAMEs values for the domains. In the example described above, the CNAME is the Azion address. |
  | `description` | Sets the string as a record description. |
  | `ttl` | Accepts a list of CNAMEs values for the domains. For example, `["www.yourdomain.com", "blog.yourdomain.com"]`. |

7. You'll receive a reponse confirming that the new record was created:

<Code lang="json" code={`
{
    "results": {
        "rdata": [
            "xxxxxxxxxx.map.azionedge.net"
        ],
        "zone_id": <hosted_zone_id>,
        "record_type": "CNAME",
        "ttl": 20,
        "policy": "simple",
        "entry": "www",
        "id": <record_id>,
        "description": "www record"
    }
}
`} />

8. Wait a couple of minutes for the changes to propagate. You can [run the DIG command](/en/documentation/products/guides/run-the-dig-command/) in your terminal to check whether your domain points to the Azion address.

:::tip
Check the [Azion API documentation](https://api.azion.com/) to know more about all features available via API.
:::
</Fragment>

<Fragment slot="panel.apiv3">

1. Run the following `GET` request to retrieve your domain's ID, replacing `TOKEN VALUE` with your [personal token](/en/documentation/products/guides/personal-tokens/):

<Code lang="bash" code={`
curl --location 'https://api.azionapi.net/domains' \
--header 'Accept: application/json; version=3' \
--header 'Authorization: Token [TOKEN VALUE]' \
`} />

2. You'll receive a response similar to this:

<Code lang="json" code={`
{
    ...
    "results": [
        {
            "id": <domain_id>,
            "name": "yourdomain.com CA1 DC-yourdomain.com",
            "cnames": [],
            "cname_access_only": true,
            "digital_certificate_id": <digital_certificate_id>,
            "edge_application_id": <edge_application_id>,
            "is_active": true,
            "domain_name": "xxxxxxxxxx.map.azionedge.net"
        }
    ]
}
`} />

3. Locate the domain you wish to link to the custom domain and copy the `domain_id` value received in the response.
4. If you have no CNAMEs listed, run a `PATCH` request, adding the `domain_id` as a path, to update the `cnames` field with the domains you wish to configure:

<Code lang="bash" code={`
curl --location --request PATCH 'https://api.azionapi.net/domains/<domain_id>' \
--header 'Accept: application/json; version=3' \
--header 'Authorization: Token [TOKEN VALUE]' \
--header 'Content-Type: application/json' \
--data '{
    "cnames": [
        "yourdomain.com",
        "*.yourdomain.com"
    ]
}'
`} />

  | Key | Description |
  | --- | --- |
  | `cnames` | Accepts a list of CNAMEs for the domains as values. For example, `["*.yourdomain.com", "blog.yourdomain.com"]`. |

:::tip
Add a wildcard (`*`) subdomain instead of a specific subdomain to cover all possible scenarios. This way, you won't need to create multiple records for `www.yourdomain.com` and `blog.yourdomain.com` if they point to the same application.
:::

5. Run a new `GET` request to retrieve the `hosted_zone_id`, which indicates [the DNS zone you created](#step-1-create-a-dns-zone):

<Code lang="json" code={`
{
    ...
    "results": [
        {
            "domain": "yourdomain.com - zone",
            "is_active": true,
            "name": "yourdomain.com",
            "id": <hosted_zone_id>
        }
    ]
}
`} />

6. Run the following `POST` request in your terminal, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/), `hosted_zone_id` with the value from the previous response and the answers list with the Azion domain address as a string:

<Code lang="bash" code={`
curl --location 'https://api.azionapi.net/intelligent_dns/<hosted_zone_id>/records' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token [TOKEN VALUE]' \
--header 'Accept: application/json; version=3' \
--data-raw '{
    "record_type": "CNAME",
    "entry": "www",
    "answers_list": [
        "xxxxxxxxxx.map.azionedge.net"
    ],
    "description": "www record",
    "ttl": 20
}'
`} />

  | Key | Description |
  | --- | --- |
  | `record_type` | The type of record being created. See a full list of accepted record types in the [Edge DNS documentation](/en/documentation/products/secure/edge-dns/). |
  | `entry` | Sets the value of the entry, appending it to the apex domain from the zone to generate the record. For example, the value `www` will represent a record for `www.yourdomain.com`. Accepts the wildcard (`*`) notation. |
  | `answers_list` | Accepts a list of CNAMEs for the domains as values. In the example described above, the CNAME is the Azion address. |
  | `description` | Sets the string as a record description. |
  | `ttl` | Accepts a list of CNAMEs for the domains as values. For example, `["www.yourdomain.com", "blog.yourdomain.com"]`. |

7. You'll receive a reponse confirming that the new record was created:

<Code lang="json" code={`
{
    "results": {
        "answers_list": [
            "xxxxxxxxxx.map.azionedge.net"
        ],
        "zone_id": <hosted_zone_id>,
        "record_type": "CNAME",
        "ttl": 20,
        "policy": "simple",
        "entry": "www",
        "id": <record_id>,
        "description": "www record"
    }
}
`} />

8. Wait a couple of minutes for the changes to propagate. You can [run the DIG command](/en/documentation/products/guides/run-the-dig-command/) in your terminal to check whether your domain points to the Azion address.

:::tip
Check the [Azion API documentation](https://api.azion.com/) to know more about all features available via API.
:::
</Fragment>

</Tabs>

## Additional resources

These guides might be helpful.

**Advanced configurations**:

- [Access root domain](/en/documentation/products/guides/secure/access-root-domain/)
- [Activate DNSSEC](/en/documentation/products/guides/secure/activate-dnssec/)
- [Authenticate Let\'s Encrypt](/en/documentation/products/guides/secure/lets-encrypt-record/)
- [Perform DNS load balance](/en/documentation/products/guides/secure/load-balance-dns/)

**Troubleshooting**:

- [How to test a DNS zone](/en/documentation/products/secure/troubleshoot/test-zone/)
- [Understanding Edge DNS Metrics](/en/documentation/products/secure/troubleshoot/edge-dns-understand-metrics/)