This page shows how to delete an API and the App Engine, Compute Engine, or GKE 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:
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 endpoints services list
Delete the API using the following command:
gcloud endpoints services delete SERVICE
SERVICEwith 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.
To delete an instance running in the App Engine flexible environment:
- Get a list of all modules and versions for your project by invoking:
gcloud app versions list
- Delete the desired API instance and API version by invoking the following:
gcloud app versions delete --service=SERVICE VERSION
SERVICEwith your API name and
VERSIONwith 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.
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.
To delete a container cluster with the
gcloud command-line tool:
gcloud container clusters delete NAME --zone ZONE
Replace NAME with the name of your cluster and ZONE with the compute zone that the cluster is in.
For more information on deleting a GKE cluster, see the GKE documentation.