Search code examples
google-cloud-platformcloud

I Can't Delete My GCP VM Instances, They are Stuck


I'm currently facing great difficulties trying to delete all my GCP VM instances, some are stuck at trying to start and every time I delete them it's showing a 404 not found meaning that the instance does not exist anymore, it's chewing through my budget as well which is super annoying.

I've got it setup that it pulls an image from the Artifact Registry and uses that inside the VM instance, I've also tried disabling delete protection which was useless because I never enabled it.

Screenshot

I've tried using the CLI with no luck.

I tried reaching out to support but I have to pay $29 per month and I cannot afford that right now.

I've tried selecting all the VM instances and clicking DELETE and it shows a 404 not found.

Can someone please try and explain to me how I can resolve this problem?

Thanks so much.


Solution

    1. Check for Accurate Instance Names: Ensure that you are using the correct instance names when trying to delete them. Double-check for typos or any naming inconsistencies.

    2. Use gcloud Command-Line Tool: Use the gcloud command-line tool to delete the instances. Open your terminal and run:

      
          gcloud compute instances delete INSTANCE_NAME
      
      

      Replace INSTANCE_NAME with the actual name of the VM instance. Repeat this command for each stuck instance.

    3. Check for Resource Deletion Status: After attempting to delete instances, it may take some time for GCP to process the deletion. Sometimes, instances may still show up in the console for a while even after being deleted. Be patient and periodically check the console to see if they eventually disappear.

    4. Check Permissions: Ensure that you have the necessary permissions to delete instances. You should have the compute.instances.delete permission for the relevant project.

    5. Billing: Review your billing dashboard to make sure that there are no unexpected charges. Sometimes, billing information might not update immediately.

    6. Check for Resource Locks: Ensure that there are no resource locks or policies that prevent the deletion of instances. Resource locks can be applied at the resource group or project level.

    7. Check for Automation Scripts: Verify that there are no automation scripts or external processes that are continually recreating these instances after deletion.