Skip to content

Instantly share code, notes, and snippets.

@gabihodoroaga
Created April 28, 2020 14:35
Show Gist options
  • Save gabihodoroaga/b4d9270e83a146e9be01c4e01c7e7a71 to your computer and use it in GitHub Desktop.
Save gabihodoroaga/b4d9270e83a146e9be01c4e01c7e7a71 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# variable
INSTANCE_NAME=ps-media
ZONE=europe-west3-c
# delete the forwarding-rule aka frontend
gcloud -q compute forwarding-rules delete $INSTANCE_NAME-forwarding-rule --global
# delete the http proxy
gcloud -q compute target-http-proxies delete $INSTANCE_NAME-http-proxy
# delete the url map
gcloud -q compute url-maps delete $INSTANCE_NAME-url-map
# delete the backend
gcloud -q compute backend-services delete $INSTANCE_NAME-lb-backend --global
# delete the instance group
gcloud -q compute instance-groups managed delete $INSTANCE_NAME-instance-group --zone $ZONE
# delete the health check
gcloud -q compute health-checks delete $INSTANCE_NAME-health-check
# delete the firewall rule
gcloud -q compute firewall-rules delete $INSTANCE_NAME-allow-health-check
# delete the instance template
gcloud -q compute instance-templates delete $INSTANCE_NAME-template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment