Deleting an API and API Instances

This page shows how to delete an API and the App Engine, Compute Engine, or Container Engine instance that the API runs on. Deleting an API removes it from the APIs list for your project in the Google Cloud Platform Console, and stops all services performed for that API, for example, API key checks.

Because deleting the API doesn't stop the instances running the API, you must also delete the instances used to run the API.

Deleting an API

To delete an API:

  1. Obtain the name of the API you want to delete. If you are unsure of the name, invoke the following command to list the APIs managed in your project:

    gcloud service-management list --produced
    
  2. Delete the API using the following command:

    gcloud service-management delete ${SERVICE_NAME}
    

    Replace ${SERVICE_NAME} with the name of your API.

Deleting API instances

Deleting an API does not delete the instances it was running on: if you want to delete the instances that are running your API, you need to delete them as well.

App Engine

To delete an instance running in the App Engine flexible environment:

  1. Get a list of all modules and versions for your project by invoking:
    gcloud app versions list
  2. Delete the desired API instance and API version by invoking the following:
    gcloud app versions delete --service=${SERVICE} ${VERSION}

    replacing ${SERVICE}with your API name and ${VERSION} with the version you are deleting. Note that you cannot delete all versions of your API! You must have at least one. Attempting to delete all versions will result in an error.

Compute Engine

Use the gcloud compute instances delete command. When you delete an instance in this way, the instance shuts down and is removed from the list of instances, and all resources attached to the instance are released, such as persistent disks and any static IP addresses.

To delete an instance, use the following command:

gcloud compute instances delete example-instance [example-instance-2 example-instance-3..]

For more information on deleting Compute Engine instances, see the Compute Engine documentation.

Container Engine

To delete a container cluster with the gcloud command-line tool:

gcloud container clusters delete NAME --zone ZONE

For more information on deleting a Container Engine cluster, see the Container Engine documentation.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Endpoints with OpenAPI