2016년 7월 7일 목요일

Google Cloud Platform billing shock (or don't forget to delete networking resources, too!)

I have played with public cloud services on AWS, Digital Ocean and recently, Google Cloud Platform (GCP). GCP is has a user-friendly, clean interface. One thing I really like is that estimated usage charges appear on-screen when you launch a compute instance.

I followed one of the GCP Kubernetes tutorials from the following link:

https://cloud.google.com/container-engine/docs/tutorials

I created a Kubernetes cluster composed of several docker containers and a load balancer to split traffic among containers running a hello world node.js app. Once you are done with the tutorial you should of course delete the resources you were using. For some reason, however, I only deleted the compute resources I used in the tutorial (Kubernetes cluster and constituent containers) but forgot to delete the load balancer. As a result, I was surprised when I got my GCP bill for June 2016:


The item Network Load Balancing Forwarding Rule Minimum Service Charge in APAC indicates that the load balancer ran for 696 hours or 4 weeks and one day! This cost me over $17 USD.

As soon as I finished the Kubernetes tutorial I made sure to delete the Kubernetes cluster, and as a result I only used 0.65 hours of compute resources costing me just 4 cents. Unfortunately, however, I neglected to delete the external load balancer (doh!) ...

The step in which you are supposed to delete the Kubernetes pod and LB are detailed here:

http://kubernetes.io/docs/hellonode/#thats-it-time-to-tear-it-down

That’s it for the demo! So you don’t leave this all running and incur charges, let’s learn how to tear things down.
Delete the Deployment (which also deletes the running pods) and Service (which also deletes your external load balancer):
kubectl delete service,deployment hello-node
I think I missed the load balancer because I deleted resources through the GCP web dashboard instead of from the command line.

To delete networking resources from the dashboard, click the icon at top left that looks like 三 and select Networking.



Then from the Networking screen, select Load Balancing:


If you have any existing load balancers they will appear in this screen and you can delete them. Hopefully other people will be able to learn from my dumb mistake and make sure to delete the networking resources in addition to their compute resources when they are done using GCP.