Skip to main content
GCPComputebeginner

Compute Engine Machine Types

Understand GCP machine families (E2, N2, C2, M2) and choose the right type for your workload.

CloudToolStack Team22 min readPublished Feb 22, 2026

Prerequisites

  • GCP project with Compute Engine access
  • Understanding of CPU, RAM, and workload profiling

Compute Engine Machine Families Overview

Google Compute Engine offers a wide range of virtual machine types organized into machine families. Each family is optimized for different workload profiles. Choosing the right machine type has a direct impact on both performance and cost. An over-provisioned VM wastes money, while an under-provisioned one creates bottlenecks that degrade user experience and slow down batch processing.

GCP organizes machine types into four main categories: General Purpose, Compute Optimized, Memory Optimized, and Accelerator Optimized. Within each category are specific machine series identified by generation letters and numbers (e.g., E2, N2, C3). Newer generations generally offer better performance-per-dollar, but availability varies by region.

The naming convention follows a pattern: [series]-[type]-[vcpus]. For example, n2-standard-8 means the N2 series, standard memory ratio, with 8 vCPUs. The memory ratio types are: standard (1:4 GB), highmem (1:8 GB), highcpu (1:1 GB), and variations like megamem and ultramem for memory-optimized families.

General Purpose Machines

General-purpose machines offer a balanced ratio of compute, memory, and networking. They are the right starting point for most workloads and should be your default choice unless you have identified a specific resource bottleneck that warrants a specialized family.

SeriesProcessorvCPU : Memory RatioMax vCPUsBest For
E2Intel / AMD (shared core available)1:4 GB (standard)32Dev/test, small workloads, cost-sensitive
N2Intel Cascade Lake / Ice Lake1:4 GB (standard)128General production, databases, web servers
N2DAMD EPYC Rome / Milan1:4 GB (standard)224Same as N2, often 10-20% cheaper
C3Intel Sapphire Rapids1:4 GB (standard)176Latest gen, best per-core performance
C3DAMD EPYC Genoa1:4 GB (standard)360Highest vCPU count, large-scale workloads
T2DAMD EPYC Milan1:4 GB (fixed)60Scale-out workloads, containerized apps

E2 Series: Cost-Optimized Development

The E2 series is GCP's most cost-effective general-purpose offering. It uses a shared-core architecture for smaller instances (e2-micro, e2-small, e2-medium) where the vCPU is a fraction of a physical core. E2 instances use CPU bursting, which means they can temporarily use more CPU than their baseline when the host has spare capacity, but sustained performance is not guaranteed.

E2 instances are ideal for development, testing, and low-traffic applications. They are not recommended for production workloads that require consistent performance because the burst model can lead to unpredictable latency under sustained load.

N2 / N2D Series: Production Workhorse

The N2 (Intel) and N2D (AMD) series are the workhorses of production GCP deployments. They provide dedicated cores with consistent performance, support custom machine types, and are eligible for Sustained Use Discounts (up to 30% automatic discount for running more than 25% of the month). The N2D series typically costs 10-20% less than N2 for equivalent performance, making it a strong default choice.

C3 / C3D Series: Latest Generation

The C3 (Intel Sapphire Rapids) and C3D (AMD EPYC Genoa) represent GCP's newest general-purpose offerings. They provide significantly better per-core performance than N2 and support up to 176 vCPUs (C3) or 360 vCPUs (C3D). However, they do not receive Sustained Use Discounts; instead, use Committed Use Discounts for cost savings with these series.

Start with E2, Graduate to N2/C3

For development and testing, E2 instances offer the lowest cost with shared-core options as small as e2-micro (0.25 vCPU, 1 GB RAM) which is also included in the GCP free tier. When promoting to production, move to N2D (for cost efficiency) or C3 (for best performance). The E2 series uses CPU bursting, which means performance can be unpredictable under sustained load.

Compute Optimized Machines

Compute-optimized machines provide the highest per-core performance for workloads that are CPU-bound. They run at higher clock speeds and are tuned for sustained compute-intensive operations.

C2 Series

The C2 series uses Intel Cascade Lake processors running at 3.8 GHz sustained all-core turbo frequency. This is the highest sustained frequency available on GCP and is ideal for single-threaded performance-sensitive workloads.

C2D Series

The C2D series uses AMD EPYC Milan processors and offers up to 112 vCPUs per VM. It provides a good balance between per-core performance and core count for workloads that benefit from both.

H3 Series

The H3 series is purpose-built for HPC (High Performance Computing) workloads. Each VM has 88 vCPUs and 352 GB of memory on Intel Sapphire Rapids processors. H3 VMs are deployed on dense nodes with 200 Gbps networking for MPI and tightly-coupled parallel workloads.

SeriesProcessorMax vCPUsBest For
C2Intel Cascade Lake (3.8 GHz)60Single-threaded apps, game servers
C2DAMD EPYC Milan112Batch processing, media transcoding
H3Intel Sapphire Rapids88 (fixed)HPC, simulations, MPI workloads

Ideal use cases for compute-optimized machines:

  • Scientific computing and simulations
  • Game servers requiring single-threaded performance
  • High-performance batch processing
  • Media transcoding pipelines
  • Computational fluid dynamics (CFD)
  • Financial modeling and risk analysis
Create a compute-optimized VM for batch processing
# C2 for single-threaded performance
gcloud compute instances create game-server-01 \
  --machine-type=c2-standard-8 \
  --zone=us-central1-a \
  --image-family=ubuntu-2404-lts \
  --image-project=ubuntu-os-cloud \
  --network-interface=no-address \
  --service-account=game-server@my-project.iam.gserviceaccount.com \
  --shielded-secure-boot \
  --shielded-vtpm

# C2D for high-core-count batch processing
gcloud compute instances create batch-processor \
  --machine-type=c2d-standard-56 \
  --zone=us-central1-a \
  --image-family=ubuntu-2404-lts \
  --image-project=ubuntu-os-cloud \
  --boot-disk-size=200GB \
  --boot-disk-type=pd-ssd \
  --local-ssd=count=4,interface=NVME

Memory Optimized Machines

Memory-optimized machines offer the highest memory-to-vCPU ratios, designed for workloads that need to keep large datasets in memory. These machines are significantly more expensive per vCPU than general-purpose instances, so they should only be used when the workload genuinely requires high memory capacity.

SeriesProcessorMax MemoryMemory/vCPUBest For
M1Intel Skylake3,844 GBUp to 24 GB/vCPULegacy SAP HANA, large in-memory workloads
M2Intel Cascade Lake11,776 GBUp to 28 GB/vCPULargest SAP HANA deployments
M3Intel Ice Lake3,904 GBUp to 30.5 GB/vCPUSAP HANA, in-memory analytics

Ideal use cases for memory-optimized machines:

  • SAP HANA in-memory databases
  • Large-scale in-memory caching (when Memorystore is not sufficient)
  • Real-time analytics with large datasets
  • Genomics and bioinformatics workloads
  • Apache Spark with large in-memory datasets

Consider Managed Alternatives First

Before provisioning memory-optimized VMs, consider whether a managed service could handle your workload. Memorystore for Redis supports up to 300 GB of in-memory data with automatic HA. BigQuery handles analytical queries over petabytes without requiring in-memory processing. Managed services eliminate operational overhead and often provide better price-performance for standard workloads.

Accelerator Optimized Machines

These machines come with attached NVIDIA GPUs for machine learning training, inference, and graphics rendering. GPU availability varies significantly by region, so check availability before committing to a specific GPU type. GPU-attached VMs have specific machine type requirements and cannot use custom machine types.

SeriesGPUGPUs per VMGPU MemoryUse Case
A2NVIDIA A1001 to 1640 or 80 GB per GPUML training, HPC
A3NVIDIA H100880 GB per GPULarge-scale ML training, LLM fine-tuning
G2NVIDIA L41 to 824 GB per GPUML inference, video transcoding, rendering

Choosing the Right GPU

The choice between GPU types depends on your workload:

  • Training large models (LLMs, diffusion models): A3 with H100 GPUs. The H100 provides 3x the training performance of the A100 for transformer-based models thanks to the Transformer Engine and FP8 support.
  • Training medium models or fine-tuning: A2 with A100 GPUs. Good balance of performance and cost. Available in more regions than A3.
  • Inference and real-time serving: G2 with L4 GPUs. Lower cost per GPU, optimized for inference with INT8 and FP8 acceleration. Also available on Cloud Run for serverless GPU inference.
  • Video transcoding and rendering: G2 with L4 GPUs. The L4 includes hardware video encoding/decoding engines.
Create GPU-accelerated VMs
# A2 VM with 1 A100 GPU for ML training
gcloud compute instances create ml-training-01 \
  --machine-type=a2-highgpu-1g \
  --zone=us-central1-a \
  --image-family=common-cu123-debian-11 \
  --image-project=deeplearning-platform-release \
  --boot-disk-size=200GB \
  --boot-disk-type=pd-ssd \
  --maintenance-policy=TERMINATE \
  --restart-on-failure

# G2 VM with 1 L4 GPU for inference
gcloud compute instances create inference-server \
  --machine-type=g2-standard-4 \
  --zone=us-central1-a \
  --image-family=common-cu123-debian-11 \
  --image-project=deeplearning-platform-release \
  --boot-disk-size=100GB \
  --provisioning-model=SPOT \
  --instance-termination-action=STOP

GPU Quota and Availability

GPU quota is limited and must be requested separately from CPU quota. Request GPU quota well in advance of needing it, as approvals can take days. Check GPU availability per zone using gcloud compute accelerator-types list before selecting your deployment region. For production ML workloads, consider using Vertex AI, which manages GPU allocation automatically and provides autoscaling.

Custom Machine Types

If predefined machine types do not match your workload, GCP allows you to create custom machine types with any combination of vCPUs and memory (within supported ratios). This can save 20-40% compared to using the next larger predefined type. Custom machine types are available for the E2, N1, N2, and N2D series.

Custom Machine Type Rules

  • vCPUs must be in multiples of 2 (or 1 for shared-core E2)
  • Memory must be in multiples of 256 MB
  • Standard memory range: 1-8 GB per vCPU
  • Extended memory (above 8 GB/vCPU) available for N1, N2, N2D at additional cost
  • The E2 series does not support extended memory
Create custom machine types
# Custom machine type: 6 vCPUs, 24 GB memory (N2 series)
gcloud compute instances create my-instance \
  --machine-type=n2-custom-6-24576 \
  --zone=us-central1-a \
  --image-family=ubuntu-2404-lts \
  --image-project=ubuntu-os-cloud

# Custom machine type with extended memory (above 8 GB/vCPU)
# Requires the "ext" suffix and costs more per GB
gcloud compute instances create high-mem-instance \
  --machine-type=n2-custom-4-32768-ext \
  --zone=us-central1-a \
  --image-family=ubuntu-2404-lts \
  --image-project=ubuntu-os-cloud

# List available machine types in a zone
gcloud compute machine-types list \
  --zones=us-central1-a \
  --filter="name:n2-standard" \
  --format="table(name, guestCpus, memoryMb, description)"
Machine TypevCPUsMemory (GB)On-Demand Price (approx)Savings vs Next Predefined
n2-standard-8832$0.388/hrBaseline
n2-custom-6-24576624$0.291/hr25% vs n2-standard-8
n2-standard-4416$0.194/hrBaseline (smaller)
n2-custom-4-20480420$0.210/hr46% vs n2-standard-8 (right-sized)

Use Custom Types for Right-Sizing

When the Recommender suggests a machine type change but the recommended predefined type still does not match your workload profile (e.g., you need 6 vCPUs but predefined types jump from 4 to 8), create a custom machine type that exactly matches your needs. This eliminates both over-provisioning and under-provisioning.

Sole-Tenant Nodes

Sole-tenant nodes provide dedicated physical servers for your VMs. Your VMs run on hardware that is not shared with any other customer. This is required for certain compliance requirements (HIPAA, PCI-DSS) and for bring-your-own-license (BYOL) scenarios where software licenses are tied to physical cores.

  • Compliance: Some regulatory frameworks require physical isolation of compute resources.
  • BYOL licensing: Software like Windows Server, SQL Server, or Oracle can be licensed per physical core. Sole-tenant nodes let you count only your cores, not shared infrastructure.
  • Anti-affinity: Ensure VMs are placed on different physical nodes for HA within a zone.
Create a sole-tenant node group
# Create a node template
gcloud compute sole-tenancy node-templates create my-template \
  --node-type=n2-node-80-640 \
  --region=us-central1

# Create a node group
gcloud compute sole-tenancy node-groups create my-node-group \
  --node-template=my-template \
  --target-size=2 \
  --zone=us-central1-a \
  --maintenance-policy=MIGRATE_WITHIN_NODE_GROUP

# Deploy a VM to the sole-tenant node group
gcloud compute instances create my-vm \
  --machine-type=n2-standard-16 \
  --zone=us-central1-a \
  --node-group=my-node-group \
  --image-family=windows-2022 \
  --image-project=windows-cloud

Pricing and Discount Programs

Compute Engine pricing is per-second with a 1-minute minimum. There are several discount mechanisms that can dramatically reduce costs. Some stack with each other, while others are mutually exclusive.

Discount TypeSavingsRequirementsApplicable Series
Sustained Use DiscountUp to 30%Run VM >25% of month (automatic)N1, N2, N2D only
Committed Use Discount (1yr)37%1-year commitment for vCPU and memoryAll series
Committed Use Discount (3yr)57%3-year commitment for vCPU and memoryAll series
Spot VMs60-91%Workload tolerates preemptionAll series

Sustained Use Discounts

Sustained Use Discounts are automatically applied to N1, N2, and N2D instances that run for more than 25% of a month. The discount increases incrementally: 0% for the first 25%, then progressively increasing up to 30% for usage exceeding 75% of the month. No commitment or configuration is required: it just happens.

Committed Use Discounts

CUDs provide 37% (1-year) or 57% (3-year) discounts in exchange for committing to a specific amount of vCPU and memory resources in a region. Unlike AWS Reserved Instances, GCP CUDs are flexible:

  • They apply to any machine type within the same region
  • You can change between machine series (N2, C3, etc.) without losing the discount
  • CUDs cover vCPU and memory amounts, not specific instance counts
  • They apply automatically to running VMs; no manual matching needed
Purchase and manage Committed Use Discounts
# Purchase a 1-year CUD for 100 vCPUs and 400 GB memory in us-central1
gcloud compute commitments create my-commitment \
  --region=us-central1 \
  --resources=vcpu=100,memory=409600MB \
  --plan=twelve-month \
  --type=GENERAL_PURPOSE

# List active commitments
gcloud compute commitments list \
  --region=us-central1 \
  --format="table(name, plan, status, resources)"

# Check CUD utilization
gcloud recommender recommendations list \
  --recommender=google.compute.commitment.UsageCommitmentRecommender \
  --project=my-project \
  --location=us-central1
GCP Cost Optimization Guide

Spot VMs

Spot VMs offer 60-91% discounts for workloads that can tolerate interruption. GCP can reclaim Spot VMs with 30 seconds notice when it needs the capacity. Spot VMs are ideal for batch processing, distributed computing, CI/CD, and any workload that can checkpoint and resume.

Launch Spot VMs for batch processing
# Single Spot VM
gcloud compute instances create batch-worker-01 \
  --machine-type=c2-standard-16 \
  --zone=us-central1-a \
  --provisioning-model=SPOT \
  --instance-termination-action=STOP \
  --maintenance-policy=TERMINATE \
  --image-family=ubuntu-2404-lts \
  --image-project=ubuntu-os-cloud

# Managed Instance Group with Spot VMs (auto-scaling batch)
gcloud compute instance-templates create spot-batch-template \
  --machine-type=c2d-standard-16 \
  --provisioning-model=SPOT \
  --instance-termination-action=DELETE \
  --image-family=ubuntu-2404-lts \
  --image-project=ubuntu-os-cloud \
  --metadata=startup-script='#!/bin/bash
    docker pull gcr.io/my-project/batch-worker:latest
    docker run --rm gcr.io/my-project/batch-worker:latest'

gcloud compute instance-groups managed create batch-workers \
  --template=spot-batch-template \
  --size=0 \
  --zone=us-central1-a

# Scale up when needed
gcloud compute instance-groups managed resize batch-workers \
  --size=20 \
  --zone=us-central1-a

Spot VM Best Practices

Always implement graceful shutdown handlers for Spot VMs. GCP sends a preemption notice 30 seconds before terminating the VM, which you can detect via the metadata server. Use --instance-termination-action=STOP if you want the VM to stop (preserving disk) rather than delete. For batch processing, checkpoint progress frequently so work is not lost on preemption. Never use Spot VMs for stateful services or databases.

Right-Sizing Recommendations

GCP automatically monitors VM utilization and provides right-sizing recommendations through the Recommender API and the Cloud Console. After a VM has been running for at least 8 days, you will see suggestions to resize if the VM is consistently underutilized. These recommendations consider CPU, memory, and network utilization patterns.

Check and apply right-sizing recommendations
# List all VM right-sizing recommendations for a project
gcloud recommender recommendations list \
  --recommender=google.compute.instance.MachineTypeRecommender \
  --project=my-project \
  --location=us-central1-a \
  --format="table(name, content.operationGroups[0].operations[0].value.machineType, stateInfo.state)"

# List idle VM recommendations (VMs that should be stopped or deleted)
gcloud recommender recommendations list \
  --recommender=google.compute.instance.IdleResourceRecommender \
  --project=my-project \
  --location=us-central1-a

# Get detailed recommendation with cost impact
gcloud recommender recommendations describe RECOMMENDATION_ID \
  --recommender=google.compute.instance.MachineTypeRecommender \
  --project=my-project \
  --location=us-central1-a

# Export recommendations to BigQuery for fleet-wide analysis
gcloud asset export \
  --content-type=recommendation \
  --project=my-project \
  --output-bigquery-force \
  --output-bigquery-dataset=my_dataset \
  --output-bigquery-table=recommendations

Do Not Blindly Follow Recommendations

Right-sizing recommendations are based on observed peak utilization. If your workload has seasonal spikes (end-of-quarter processing, Black Friday traffic), the recommendation period may not capture peak usage. Always check at least 30 days of utilization data before downsizing, and consider using autoscaling Managed Instance Groups instead of fixed-size VMs for variable workloads.

Machine Type Selection Decision Framework

Use this framework to select the right machine type for your workload:

Workload CharacteristicRecommended SeriesWhy
Dev/test, low trafficE2 (shared-core)Lowest cost, free tier eligible
General productionN2D or C3DBest price-performance for most workloads
Latency-sensitive single-threadedC2Highest per-core clock speed
Scale-out containersT2D or E2Optimized for horizontal scaling
In-memory databasesM3Highest memory-to-CPU ratio
ML trainingA2 or A3 (with GPUs)Purpose-built for GPU workloads
ML inferenceG2 (or Cloud Run with GPU)Cost-effective L4 GPUs
HPC / simulationsH3 or C2DHigh core count, fast interconnect

Consider Serverless First

Before choosing a machine type, ask whether you need a VM at all. Cloud Run, Cloud Functions, and GKE Autopilot abstract away machine selection entirely and often provide better cost efficiency for variable workloads. Use Compute Engine VMs when you need persistent local storage, specific hardware (GPUs, local SSDs), or workloads that do not fit the serverless model.

GKE vs Cloud Run Decision GuideGCP Architecture Framework

Key Takeaways

  1. 1E2 is the most cost-effective for general workloads. Use it as the default starting point.
  2. 2N2/N2D offer higher per-core performance for production workloads needing consistent speed.
  3. 3C2/C2D are compute-optimized for HPC, gaming, and CPU-intensive batch processing.
  4. 4M2/M3 are memory-optimized for SAP HANA, large databases, and in-memory analytics.
  5. 5Custom machine types let you specify exact vCPU and memory for cost optimization.
  6. 6Spot VMs offer up to 91% discount for fault-tolerant, interruptible workloads.

Frequently Asked Questions

What is the difference between E2 and N2 machine types?
E2 instances are the most cost-effective general-purpose VMs with dynamic resource management. N2 instances offer higher and more consistent per-core performance at higher cost. Use E2 for development, small apps, and cost-sensitive workloads. Use N2 for production workloads needing consistent performance.
What are custom machine types?
Custom machine types let you specify the exact number of vCPUs and amount of memory for your VM. This avoids paying for unused resources in predefined sizes. Custom types cost slightly more per resource unit but can save money by right-sizing.
When should I use Spot VMs?
Use Spot VMs for fault-tolerant workloads that can handle interruption: batch processing, data pipelines, CI/CD builds, rendering, and stateless containers. Spot VMs can be preempted with 30 seconds notice. Savings are up to 91% versus on-demand.
How do I choose the right machine family?
Start with E2 for cost-efficiency. Move to N2/N2D for consistent production performance. Use C2/C2D for CPU-bound workloads. Use M2/M3 for memory-intensive applications. Use A2/G2 for GPU workloads. Monitor actual utilization and right-size accordingly.
What is the difference between Sole-tenant nodes and regular VMs?
Sole-tenant nodes give you dedicated physical servers not shared with other customers. Use them for compliance requirements, BYOL (bring your own license), and workloads requiring physical isolation. They cost more but provide hardware-level isolation.

Written by CloudToolStack Team

Cloud engineers and architects with hands-on experience across AWS, Azure, and GCP. We write guides based on real-world production patterns, not just documentation rewrites.

Disclaimer: This guide is for educational purposes. Cloud services change frequently; always refer to official documentation for the latest information. AWS, Azure, and GCP are trademarks of their respective owners.