Deleting a resource
- In the management console
, select the folder where your resource is located. - Select Cloud CDN.
- Click the resource name.
- In the top-right corner, click
Delete and then click Delete in the window that opens.
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 resource delete command:
yc cdn resource delete --help
-
Get a list of all resources in the default folder:
yc cdn resource list --format yaml
Result:
id: s0me1dkfjq******** folder_id: s0mef01der7p******** cname: testexample.com ... ssl_certificate: type: DONT_USE status: READY
-
Delete the resource:
yc cdn resource delete <resource_ID>
For more information about the
yc cdn resource delete
command, see the CLI reference. -
Make sure that the delete operation was successful. To do this, view the folder's resource list again:
yc cdn resource list
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete a CDN resource created with Terraform:
-
Open the Terraform configuration file and delete the resource description fragment.
An example of describing a CDN resource in the Terraform configuration
resource "yandex_cdn_resource" "my_resource" { cname = "cdn1.yandex-example.ru" active = false origin_protocol = "https" secondary_hostnames = ["cdn-example-1.yandex.ru", "cdn-example-2.yandex.ru"] origin_group_id = yandex_cdn_origin_group.my_group.id ... options { edge_cache_settings = "345600" ignore_cookie = true ... } }
-
In the command line, go to the folder 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 whether the CDN resource has been deleted using the management console
or this CLI command:yc cdn resource list
To delete a resource, use the delete REST API method for the Resource resource or the ResourceService/Delete gRPC API call.