Skip to main content

Remediation

Consider resizing an Google GCE Instance to a smaller, more cost-effective machine type that aligns with its workload requirements or terminating it if it's no longer required.

Resize the Instance

Using gcloud CLI

  1. Stop the instance:
gcloud compute instances stop {{instance-name}} --zone=ZONE
  1. Change the machine type:
gcloud compute instances set-machine-type {{instance-name}} \
--machine-type={{new-machine-type}} \
--zone={{zone}}
  1. Start the instance:
gcloud compute instances start {{instance-name}} --zone={{zone}}

Considerations

  • Ensure a recent snapshot or backup of the instance’s disks before resizing.
  • Validate that the selected machine type provides sufficient performance for the application’s needs.

Terminate the Instance

Using gcloud CLI

If the instance is consistently underutilized and no longer required, terminate it to fully eliminate costs.

gcloud compute instances delete {{instance-name}} --zone={{zone}}

Considerations

  • Termination is permanent and deletes all associated resources that are not separately preserved (e.g., disks if not set to retain).
  • If long-term retention is needed, consider creating an image or snapshot before deletion.