Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2023 Intertech Services AG
Yandex API Gateway
  • Getting started
  • Access management
  • Pricing policy
  • FAQ
  1. Step-by-step guides
  2. Managing API gateways
  3. Deleting API gateways

Deleting API gateways

Written by
Yandex Cloud
,
improved by
Mikhail P.
Management console
CLI
Terraform
Yandex Cloud Toolkit
API

To delete an API gateway:

  1. In the management console, select the folder where you wish to delete an API gateway.
  2. In the list of services, select API Gateway.
  3. In the API gateway row, click and select Delete.
  4. In the window that opens, click Delete.

To delete an API gateway, run the command below:

yc serverless api-gateway delete --id <API gateway ID>

Where id is the ID of the API gateway.

Result:

done (18s)

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. They store the infrastructure description in HashiCorp Configuration Language (HCL). Terraform and its providers are distributed under the Business Source License.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

If you change the configuration files, Terraform automatically determines which part of your configuration is already deployed and what should be added or removed.

If you don't have Terraform, install it and configure the Yandex Cloud provider.

To delete an API gateway created using Terraform:

  1. 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
    }
    ...
    
  2. In the command line, go to the directory with the Terraform configuration file.

  3. Check the configuration using this command:

    terraform validate
    

    If the configuration is correct, you will get this message:

    Success! The configuration is valid.
    
  4. 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.

  5. Apply the configuration changes:

    terraform apply
    
  6. Confirm the changes: type yes into the terminal and press Enter.

    You can verify the changes using the management console or the CLI command below:

    yc serverless api-gateway list
    

You can delete an API gateway using the Yandex Cloud Toolkit plugin for the family of IDEs on the JetBrains IntelliJ platform.

To delete an API gateway, use the delete REST API method for the ApiGateway resource or the ApiGatewayService/Delete gRPC API call.

Was the article helpful?

Yandex project
© 2023 Intertech Services AG