Home› Blog› GCP Architecture Series #114 — Custom Machine Types and Extended Memory…
GCP Architecture GCP Architecture Series

GCP Architecture Series #114 — Custom Machine Types and Extended Memory

#111 flagged custom machine types as a narrow escape hatch and #112 noted N2's extended memory is really a licensing lever. Both are true and both understate how constrained the feature is. “Custom” turns out to mean a different allowed set of vCPU counts per series rather than any number; extended memory covers fewer series than custom types do and forfeits a discount; and the unit the whole thing is configured in is documented as not meaning what it says.

Verified against current vendor documentation on 5 December 2026. Pricing, limits and API behaviour were checked against the official docs on that date. Cloud services change fast — if you are reading this much later, treat the specifics as a starting point and re-check the linked sources.

Business Challenge

Three posts have now ended by pointing at this feature. #111 called it a narrow escape hatch; #112 noted that N2's extended memory is documented as a software-licensing lever rather than a capacity one. The premise is simple enough: a predefined machine type has a preset number of vCPUs and amount of memory and has a set price. If predefined VMs don't meet your needs, you can create a VM instance with custom virtualized hardware settings.

What that actually permits is narrower than "custom" suggests, in three separate ways — which series, which numbers, and which units.

1
"We asked for 34 vCPUs and the API refused"

Because N2 does not allow 34. Its rule is multiples of 2 (up to 32) or 4 (32 to 80) — so past 32 the step doubles, and 34 falls between two legal values.

Every series has its own set. The AMD ones are the strictest: N4D and N2D both allow only 2, 4, 8, 16, 32, 48, 64, 80, 96 — nine discrete values rather than a range. N4 takes any multiple of 2 up to 80, N1 takes 1 or any multiple of 2, and exactly one series is unrestricted: N4A, which takes Any count from 1 to 64.

Correct approach

Treat "custom" as "choose from this series' set", and read the set before sizing. If a capacity model genuinely needs arbitrary vCPU counts, N4A is the only series that provides them — which is a meaningful reason to pick Arm beyond price.

2
"We specified 5,000 MB for 5 GB and got an error"

That exact case is in the documentation as a worked failure: if you try to provision 5 GB of memory by specifying 5,000 MB in an API request, the API returns an error. Two rules combine to cause it.

First, the units are not what they are called: for historical reasons, Google Cloud tools and documentation refer to machine type memory as decimal megabytes (MB) and gigabytes (GB). However, these units represent binary gibibytes and mebibytes. Second, the value must land on a step: in the Compute Engine API, you must provide memory in MB as an integer multiple of 256 MB (or 1,024 MB for G2 VMs). 5,000 MB is not a multiple of 256.

Correct approach

Work in multiples of 256 and let the tooling convert. The console takes round numbers — in the Google Cloud console, you specify memory in GB. For example, if your system needs 1,024 MB of memory, select 1 GB — while the CLI accepts either form: to express 0.25 GB (256 MB) increments such as 5.75 GB, either convert the value to an integer in MB (--custom-memory=5888MB) or include the GB unit suffix (--custom-memory=5.75GB). One flag is stricter: with the --machine-type flag, you must specify memory in MB as an integer without a unit suffix.

3
"We bought a commitment to cancel out the custom premium"

A commitment lowers the rate; it does not remove the premium. The on-demand prices for custom machine types include a 5% premium over the on-demand prices for predefined machine types — and separately, if you use your commitments to run custom machine types, then Compute Engine charges a 5% premium over the commitment prices. Compute Engine charges this premium for the portion and duration of your commitment that you run these custom machine type VMs.

Extended memory makes it worse rather than better, because that portion is excluded from the discount entirely: extended memory doesn't qualify for resource-based committed use discounts.

Correct approach

Price the custom shape against the next predefined size up, including the premium on whichever rate you will actually pay. The feature earns its keep where a predefined jump would buy cores you cannot use — which is exactly the scenario Google names: workloads that require more processing power or more memory but don't need all the upgrades that the next-level machine type provides.

Architecture

Eight series, their allowed sets, and two features that are easy to conflate.

Diagram: custom machine types and extended memory in Compute Engine; custom machine types exist on the N4, N4D, N4A, N2, N2D, E2 and N1 series in the general-purpose family plus the G2 series in the accelerator-optimized family, which the machine-families guide omits when it describes custom types as being for the N and E series only; custom does not mean any number, because N2 allows multiples of two up to thirty-two and multiples of four from thirty-two to eighty so thirty-four vCPUs cannot be requested, N4D and N2D allow only nine discrete values, N4 allows any multiple of two, N4A allows any value and is the only unrestricted series, N1 has a memory floor of 0.9 gigabytes per vCPU and a ceiling of 6.5 where newer series reach eight, and E2 shared-core goes below one vCPU at 0.25, 0.5 and 1; extended memory is narrower than custom types, covering only N4, N4A, N4D, N2, N2D and N1 while excluding predefined types and G2 and E2 custom types, and it does not qualify for resource-based committed use discounts; the gigabyte unit actually means gibibyte and memory must land on a 256 megabyte step or 1,024 for G2, so specifying 5,000 megabytes for five gigabytes returns an error because five gigabytes is 5,120 megabytes in these units; and the cost is a five percent premium over predefined on-demand prices that also applies on top of commitment prices, with sustained use discounts calculated differently and no reshaping possible once Local SSD is attached
Where custom shapes exist, which numbers they allow, and what the premium attaches to.

Where custom machine types exist, and a discrepancy worth knowing

The custom machine type page lists two families. General-purpose machine family for the N and E machine series only. You can create a custom VM on the N4, N4D, N4A, N2, N2D, E2, or N1 machine series. And then one more: accelerator-optimized machine family for the G2 machine series only.

That second entry does not appear in the machine families guide, which says custom types are available for the N and E machine series in the general-purpose machine family and stops there. Both pages are live today. The fuller list is eight series, seven of them general-purpose and one accelerated — so the summary is accurate about seven-eighths of the feature and silent about the rest. I took the narrower wording at face value in #111; the per-feature page is the more complete source.

G2's customisation is also shaped differently from the others, because the GPU count constrains it: G2 (NVIDIA L4) lets you customize vCPUs (4, 8, 12, 16, or 32) when Number of GPUs is 1, whereas for 2, 4, or 8 L4 GPUs the vCPU count is fixed (24, 48, or 96) and only memory is customizable. One GPU buys a choice of cores; more than one takes that choice away.

The allowed sets, series by series

The constraint table is the part worth internalising, because it is where sizing plans fail. Reading it across — series, minimum vCPUs, maximum, allowed values, memory floor and ceiling per vCPU, step size, extended memory:

N4 2 80 Any multiple of 2 2 8 256 Yes. N4D 2 96 2, 4, 8, 16, 32, 48, 64, 80, 96 0.5 8 256 Yes. N4A 1 64 Any 2 8 256 Yes. N2 2 80 Multiples of 2 (up to 32) or 4 (32 to 80) 0.5 8 256 Yes. N2D 2 96 2, 4, 8, 16, 32, 48, 64, 80, 96 0.5 8 256 Yes. N1 1 96 1 or any multiple of 2 0.9 (1 for 1 or 2 vCPUs) 6.5 256 Yes. E2 2 32 Any multiple of 2 0.5 8 256 No.

Three things stand out. N1, the oldest series, is the only one whose memory floor is not 0.5 in that column, and the only one whose ceiling is not 8 — it runs 0.9 (1 for 1 or 2 vCPUs) to 6.5, which is the N1 hardware showing through. The two Arm and AMD fourth-generation series have a floor of 2 rather than 0.5, so you cannot build a very low-memory shape on N4 or N4A. And the step size is 256 MB everywhere.

Below all of that sits a row that goes under one vCPU: E2 shared-core 0.25 1 0.25, 0.5, 1 1 total 8 (2 total for micro, 4 total for small, 8 total for medium) 256 No. Fractional vCPUs, configurable — which is the shared-core mechanism from #111 and #112 exposed as a dial rather than as three fixed names.

Extended memory is a different, narrower feature

Custom machine types let you choose a ratio inside the allowed band. Extended memory is what you use to go past the top of it: instead of using the default memory size based on the number of vCPUs you select, you can specify an amount of memory, up to the limit for the machine series.

It covers fewer series than custom types do: extended memory is available on N4, N4A, N4D, N2, N2D, and N1 custom machine types. Six, not eight. And explicitly: predefined machine types, as well as G2 and E2 custom machine types, don't support extended memory. So the cheapest series in the family and the accelerated one are both excluded — E2 can be customised but cannot be extended.

The cost is the part to plan around: extended memory doesn't qualify for resource-based committed use discounts. Memory beyond the default ratio is priced on demand however long the VM runs, which means a long-lived extended-memory VM has a permanently undiscounted component. Against that, #112's point stands: when a database is licensed per core, buying memory without buying cores is still usually the cheaper total.

Changing an existing VM is a separate permission from creating one — to add extended memory to an existing VM: compute.instances.setMachineType on the VM, against to create a VM with a custom machine type: compute.instances.create on the project — both covered by the role Google names: to get the permissions that you need to create a VM with a custom machine type, ask your administrator to grant you the Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM role on the project.

Why This Architecture Holds Up

Google lists three scenarios for custom VMs. Two are about fit: workloads that aren't a good fit for the predefined VM types, and workloads that require more processing power or more memory but don't need all the upgrades that the next-level machine type provides. Both are real and both are worth about 5% at most, because that is the premium you are paying to avoid over-provisioning.

The third is a different order of magnitude: workloads that have per-CPU software license costs, where you can customize the number of vCPUs to avoid license costs for unused processing power or to match available software license counts.

Per-core licensing for commercial databases is routinely a larger line item than the compute underneath it. If a predefined shape forces 16 vCPUs when the workload needs 10, the waste is not 6 vCPUs of Compute Engine billing — it is 6 cores of licence. A 5% infrastructure premium that removes that is not a close call. The phrase "to match available software license counts" points at the other direction too: shaping a VM to licences you already own rather than buying more.

That reframes the pricing model generally. Compute Engine charges for custom VMs based on the number of vCPUs and memory hours that the VM uses. This pricing model differs from how Compute Engine charges for predefined machine types — you are billed for two resources separately rather than for a bundle, which is what makes shaping them independently meaningful. Within the normal band there is no extra charge for an unusual ratio: when you use a custom machine type, any memory up to and including the default amount per vCPU is charged at the machine family custom machine type pricing.

Three operational constraints that are easy to discover late

The first is a hard stop on reshaping: if your VM has Local SSD disks, you can't change the vCPU and memory configuration. Local SSD is physically attached to the host, so resizing is not a matter of changing a number. If a workload is expected to be resized over its life, that is an argument against Local SSD independent of performance.

The second is that the discount arithmetic changes shape: custom VMs are subject to the same 1-minute minimum charge as any other instance, but sustained use discounts for custom machine types are calculated differently. Any cost model that applies a standard SUD curve to custom VMs is approximating something that is documented as not working that way — and on E2, per #112, SUDs do not exist at all.

The third is small and clarifying: E2 custom machine and E2 shared-core custom machine types share the same pricing scheme. The fractional-vCPU shapes are not a separate billing regime from ordinary E2 custom VMs.

Key Architecture Decisions

Situation Decision Because
Per-core licensed software Custom type, sized to the licence Google names this case explicitly; the 5% is small against a core licence.
Needing an arbitrary vCPU count N4A — the only "Any" series Every other series allows multiples or a fixed list.
Planning a shape above 32 vCPUs on N2 Round to a multiple of 4 The step changes from 2 to 4 at that boundary.
Sizing on N4D or N2D Pick from the nine listed values Those series publish a list, not a range.
Very low memory per vCPU N2, N2D, N1 or E2 — not N4 or N4A The fourth-generation floor in that column is 2, not 0.5.
Memory above the series default ratio Extended memory, on an N series G2, E2 and all predefined types don't support it.
Long-running VM with extended memory Exclude that memory from CUD forecasts Extended memory doesn't qualify for resource-based CUDs.
Buying a commitment for custom VMs Add 5% on top of the committed rate The premium applies to commitment prices too.
Setting memory via the API Use a multiple of 256 MB 5,000 MB is a documented error: it is not a multiple of 256.
Reading any GB figure here Treat it as GiB The units are binary despite the decimal names.
VM that may be resized later Avoid Local SSD Local SSD freezes the vCPU and memory configuration.
Custom G2 with more than one GPU Plan on fixed vCPUs, custom memory only 2, 4 or 8 L4 GPUs fix the count at 24, 48 or 96.
Applying a standard SUD curve Don't, for custom VMs Sustained use discounts are calculated differently.

The one to look at today

Find every custom machine type running in your projects and check two columns against the table above: whether its vCPU count is a legal value for a series you might migrate it to, and whether it carries extended memory. The first determines whether an N2-to-N4 move is a rename or a resize. The second determines whether part of that VM has been sitting outside your committed use discount the whole time — which will not appear as an anomaly anywhere, because it is working as documented.

Closing Thought

Four posts in, the compute phase has a consistent texture. The names are a grammar whose vocabulary shifts per series. The families do not partition the way the letters imply. And now the escape hatch from all of it turns out to have its own grid: eight series, each with a published set of legal vCPU counts, a memory band, and a 256 MB quantum underneath.

"Custom" is doing the same work "standard" and "compute-optimized" were doing in the previous three — naming a direction accurately while saying nothing about the limits. The useful reflex stays the same: the word tells you which table to open, and the table is the product.

Next in this series

#115 moves from shaping the hardware to what boots on it — machine images, custom images and image families, where the question becomes how a known-good configuration is captured and handed to the next instance.

Comments

How was your experience?
Your feedback helps improve this site.
PoorExcellent