Thanks. It turned out to be pretty crazy -- the GCP console site is just a front end to a set of back end APIs. Many of those APIs are disabled by default for Google users. Rather than display a message informing the user that a certain API is currently disabled therefore functionality is restricted, the front end just blows up with a meaningless error message. The user has to search the internet to find the relevant reddit post explaining the problem and remedy.
Yeah, that's a well-known rite of passage with GCP. The "API not enabled" failure mode is especially bad because the error often surfaces deep in a client library as a generic 403 or PERMISSION_DENIED, which sends people down the IAM rabbit hole when the actual fix is a one-line gcloud services enable. DO and Vultr's "sign up, get a token, go" experience really spoiled us.
Worth noting: this is also why I had the provider's __init__ lazy-import the DNS client — if a user only wants VMs and never touches DNS, they shouldn't hit a Cloud DNS API-disabled error at startup. They'll only see it when they actually try a DNS operation.
It's the GCE machine type — the predefined CPU/memory shape your VM gets. The provider takes the value verbatim and builds the full URL:
machine_type=f"zones/{zone}/machineTypes/{size}"
(machine/providers/gcp.py:138)
So if you set machine-size: e2-standard-2, the API call references zones/us-central1-a/machineTypes/e2-standard-2.
| Family | When to use | Examples |
|---|---|---|
e2-* |
Cheapest, general-purpose, good default | e2-micro (free-tier eligible), e2-small, e2-medium, e2-standard-2, e2-standard-4 |
n2-* / n2d-* |
Balanced general-purpose, more consistent perf than e2 | n2-standard-2, n2d-standard-4 |
c2-* / c3-* |
Compute-bound workloads | c2-standard-4 |
m2-* / m3-* |
Memory-heavy workloads | m2-ultramem-208 |
t2d-* |
AMD-based, best perf/$ for general workloads | t2d-standard-2 |
Naming convention: <family>-<class>-<vCPU count>. So e2-standard-4 = E2 family, "standard" memory ratio (4 GB/vCPU), 4 vCPUs.
gcloud compute machine-types list --zones=us-central1-a
Not every type exists in every zone, so it's worth checking before settling on one. Custom machine types (arbitrary CPU+RAM) are also supported via a more elaborate string, but for typical use one of the predefined shapes is what you want.