Removing a domain
-
In the management console
, select the folder containing the API gateway. -
Navigate
to API Gateway. -
Click the API gateway name.
-
Navigate to the Domains tab.
-
Click
in the domain row and select Detach. -
Confirm your action.
-
Delete the resource record created when adding the domain to the API gateway:
-
If your domain is delegated to Cloud DNS:
- Navigate
to Cloud DNS. - Select the zone hosting the domain.
- Click
in the record row with the icon and select Delete. - Confirm the deletion.
- Navigate
-
If a third-party DNS provider manages your domain, delete the record on the domain management page of your provider.
-
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id.
If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
View the description of the CLI command for removing a domain:
yc serverless api-gateway remove-domain --help -
Run this command:
yc serverless api-gateway remove-domain <API_gateway_ID> --domain-id <domain_ID> -
Delete the resource record created when adding the domain to the API gateway:
-
If your domain is delegated to Cloud DNS:
-
Get a list of all records in the DNS zone by specifying the relevant zone ID:
yc dns zone list-records <DNS_zone_ID>The record in question is of the
ANAMEtype and has a value ind5dm1lba80md********.i9******.apigw.yandexcloud.netformat. -
Delete the record:
yc dns zone delete-records <DNS_zone_ID> \ --record "<domain_name> <TTL> <record_type> <value>"
-
-
If a third-party DNS provider manages your domain, delete the record on the domain management page of your provider.
-
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
-
Open the Terraform configuration file and delete the
custom_domainssection with the domain to remove from theyandex_api_gatewaydescription:resource "yandex_api_gateway" "<API_gateway_name>" { name = "<API_gateway_name>" ... custom_domains { fqdn = "<domain_name>" certificate_id = "<certificate_ID>" } }For more information about the properties of the
yandex_api_gatewayresource, see this provider guide. -
Apply the changes:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
-
-
Delete the resource record created when adding the domain to the API gateway:
-
If your domain is delegated to Cloud DNS, delete the ANAME record in the DNS zone.
-
If a third-party DNS provider manages your domain, delete the record on the domain management page of your provider.
-
To remove a domain from an API gateway, use the removeDomain REST API method for the ApiGateway resource or the ApiGatewayService/RemoveDomain gRPC API call.
Delete the resource record created when adding the domain to the API gateway:
-
If your domain is delegated to Cloud DNS, use the updateRecordSets REST API method for the DnsZone resource or the DnsZoneService/UpdateRecordSets gRPC API call.
-
If a third-party DNS provider manages your domain, delete the record on the domain management page of your provider.