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 relevant documentation on the Terraform
If you do not have Terraform yet, 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 of an 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
You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply
-
Type
yes
and press Enter to confirm the changes.You can check the update using the management console
or these CLI commands: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.