Deleting an API gateway
To delete an API gateway:
- In the management console
, go to the folder where you want to delete an API gateway. - In the list of services, select API Gateway.
- In the API gateway row, click
and select Delete. - In the window that opens, click Delete.
To delete an API gateway, run this command:
yc serverless api-gateway delete --id <API_gateway_ID>
Result:
done (18s)
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the documentation on the Terraform
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete an API gateway created using Terraform:
-
Open the Terraform configuration file and delete the fragment with the API gateway description.
Example API gateway description in the Terraform configuration:
... resource "yandex_api_gateway" "test-api-gateway" { name = "some_name" description = "any description" labels = { label = "label" empty-label = "" } spec = <<-EOT openapi: "3.0.0" info: version: 1.0.0 title: Test API paths: /hello: get: summary: Say hello operationId: hello parameters: - name: user in: query description: User name to appear in greetings. required: false schema: type: string default: 'world' responses: '200': description: Greeting. content: 'text/plain': schema: type: "string" x-yc-apigateway-integration: type: dummy http_code: 200 http_headers: 'Content-Type': "text/plain" content: 'text/plain': "Hello again, {user}!\n" EOT } ...
-
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 update using the management console
or this CLI command:yc serverless api-gateway list
To delete an API gateway, use the delete REST API method for the ApiGateway resource or the ApiGatewayService/Delete gRPC API call.
You can delete an API gateway using the Yandex Cloud Toolkit plugin