Change the billing account of all your GCP projects at once

If you are using GCP, you may at one point need to change the billing account associated with all your projects. This “billing account migration” can happen for a number of reasons, but a common one is the consolidation of several existing billing accounts under a new one. Below, you’ll find a small script to allow you to do that quickly. This script takes all the projects linked to one billing account and reassigns them to a new one.

Protect your GCP projects against accidental deletion

Google Cloud Platform (GCP) uses a specific resource hierarchy. At the very top, you have an organisation, tied to a domain (for example: mrtrustor.net). Inside that organisation, you can have folders and subfolders. Finally, you have projects, which can be inside folders, or directly under the organisation node. Projects are where your cloud resources (VMs, databases, etc.) actually live. By default, projects are completely isolated from one another, especially at a network level.

How to use Kubernetes to fix GKE

Note: Since writing this post, I joined Google. We have released a feature called IP Aliases that addresses the problem described in this article, and much more. Activating IP Aliases requires creating a new cluster. If you can’t do that, then you can now change the configuration of the ip-masquerade-agent as described here. This gives the same end-result as the solution described in this article, but is much cleaner.