Updating a DNS zone
You can modify a DNS zone after it is created by renaming it or adding a description.
To update a DNS zone:
- In the management console
, select the folder where you want to update a DNS zone. - Select Cloud DNS.
- Click
in the row of the zone to update. - In the menu that opens, click Edit.
- Edit the zone settings.
- Click Save.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To update a DNS zone:
-
View a description of the CLI update zone command:
yc dns zone update --help
-
Change the visibility of the zone in the networks:
yc dns zone update <zone_name_or_ID> --network-ids=<network_IDs_for_the_zone>,
Where
--network-ids
refers to the IDs of the networks for the zone.Result:
id: aet29qhara5j******** folder_id: aoerb349v3h4******** created_at: "2021-02-21T09:21:03.935Z" name: new-zone-name zone: staging. private_visibility: network_ids: - c645mh47vsc********
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To update a DNS zone created using Terraform:
-
Open the Terraform configuration file and edit the fragment with the DNS zone description.
Example DNS zone description in the Terraform configuration
resource "yandex_vpc_network" "foo" {} resource "yandex_dns_zone" "zone1" { name = "my-public-zone" description = "Test public zone" labels = { label1 = "test-public" } zone = "test.example-public2.com." }
-
Check the configuration using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Confirm the changes: type
yes
into the terminal and press Enter.You can make sure the DNS zone has been updated in the management console
or via the CLI command below:yc dns zone get <zone_name>
To update a DNS zone, use the update REST API method for the DnsZone resource or the DnsZoneService/Update gRPC API call.