Deleting a DNS zone
To delete a DNS zone:
- In the management console
, select the folder to delete a DNS zone from. - Select Cloud DNS.
- Click
in the row of the zone to delete. - In the menu that opens, click Delete.
- In the window that opens, click Delete.
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.
-
View a description of the CLI delete zone command:
yc dns zone delete --help
-
Get a list of all DNS zones in the default folder:
yc dns zone list
-
Select the
ID
orNAME
of the zone. -
Delete the zone from the default folder:
yc dns zone delete <zone_name_or_ID>
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete a DNS zone created using Terraform:
-
Open the Terraform configuration file and delete 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." }
-
In the command line, go to the directory with the Terraform configuration file.
-
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.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can check the DNS zone deletion using the management console
or this CLI command:yc dns zone list
To delete a DNS zone, use the delete REST API method for the DnsZone resource or the DnsZoneService/Delete gRPC API call.