The Azure G-series to Ev5 upgrade policy flags Azure Virtual Machines on G-series sizes, such as Standard_G4, and recommends an Ev5 or Edv5 size instead. A Standard_E32_v5 costs about 54% less per month than a Standard_G4 in East US 2, with more vCPUs and more memory. Apply this policy to any azurerm_linux_virtual_machine or azurerm_windows_virtual_machine whose size is a G-series value.
Attribute | Detail |
|---|---|
Cloud Provider | Microsoft Azure |
Resource Type | Azure Virtual Machines, memory-optimized G-series sizes ( |
Terraform Attribute |
|
Compliant Value | An Ev5 or Edv5 size such as |
Cost Impact | About 54% lower monthly compute cost moving |
Retirement | Microsoft retires the G-series and GS-series on November 15, 2028 |
Why This Policy Matters
How It Helps Reduce Cloud Costs
The Azure G-series is one of Azure's earliest memory-optimized VM families. It launched in 2015 on Intel Xeon E5 v3 (Haswell) processors, with up to 448 GiB of memory and a very large local SSD.
The Ev5 series is the current-generation memory-optimized family. It runs on 3rd Generation Intel Xeon Platinum (Ice Lake) processors with an all-core turbo of up to 3.5 GHz.
Staying on a G-series size means paying a premium rate for decade-old hardware. This configuration increases costs without improving performance.
The G-series is also on a fixed retirement path. Microsoft has announced capacity growth restrictions for the G-series starting July 2026, and new subscriptions cannot deploy G-series sizes.
The hard deadline is November 15, 2028. After that date, Microsoft deallocates remaining Azure G-series VMs, and they stop working.
Potential Savings
The Azure G-series to Ev5 upgrade saves money because an Ev5 size with the same or more memory costs far less than the G-series size it replaces.
Size | vCPUs | Memory | Local temp disk | Approx. monthly cost (Linux, pay-as-you-go) |
|---|---|---|---|---|
| 16 | 224 GiB | 3,072 GiB | $3,212 (East US 2) |
| 32 | 256 GiB | None | $1,472 (East US 2) |
| 32 | 256 GiB | 1,200 GiB | $1,682 (East US 2) |
Moving one Standard_G4 to Standard_E32_v5 cuts its compute cost by about 54%, or roughly $20,880 per year. Moving it to Standard_E32d_v5 cuts it by about 48%, or roughly $18,360 per year.
Prices vary by region, operating system, and commitment type. Confirm current list prices for your region in the Azure Pricing Calculator before planning a migration.
G-series VMs are expensive individually, so even a small fleet adds up. Five Standard_G4 VMs moved to Standard_E32_v5 save roughly $104,000 per year at these list prices.
Implementation Guide
Most of the work in an Azure G-series to Ev5 migration is choosing the right target size and handling the local disk. The Terraform change itself is a single attribute.
Infrastructure-as-Code Example (Terraform)
The following examples show an Azure Linux virtual machine on a G-series size, and the corrected Ev5 configuration.
Non-compliant configuration: Azure VM on a G-series size
Standard_G4 pays more than twice the Ev5 rate for an older processor and less memory. This is a common source of wasted spend in subscriptions where a large memory-optimized VM was sized years ago and never revisited.
Compliant configuration: Azure VM on Ev5
The only change is the size attribute. The StandardSSD_LRS OS disk works on both sizes, because neither Standard_G4nor Standard_E32_v5 supports Premium Storage.
Map by memory, not by the number in the size name. G-series sizes carry 14 GiB of memory per vCPU, while Ev5 sizes carry 8 GiB per vCPU, so the matching Ev5 size has twice the vCPU count.
G-series size | vCPUs / Memory / Temp disk | Ev5 size (Edv5 with temp disk) | vCPUs / Memory / Edv5 temp disk |
|---|---|---|---|
| 2 / 28 GiB / 384 GiB |
| 4 / 32 GiB / 150 GiB |
| 4 / 56 GiB / 768 GiB |
| 8 / 64 GiB / 300 GiB |
| 8 / 112 GiB / 1,536 GiB |
| 16 / 128 GiB / 600 GiB |
| 16 / 224 GiB / 3,072 GiB |
| 32 / 256 GiB / 1,200 GiB |
| 32 / 448 GiB / 6,144 GiB |
| 64 / 512 GiB / 2,400 GiB |
Pick the target series by how the VM uses its local temp disk and its managed disks.
Workload on the G-series VM | Recommended target |
|---|---|
Linux, all data on Standard HDD or Standard SSD managed disks | Ev5, for example |
Uses the temp disk for scratch data, cache, or swap | Edv5, for example |
Windows VM | Edv5, because Windows cannot resize directly between sizes with and without a temp disk |
Needs Premium SSD after the move | Esv5 or Edsv5, for example |
Depends on multiple terabytes of fast local storage | Consider the storage-optimized Lsv3 series instead, which Microsoft lists as a G-series modernization target |
Step-by-Step Fix Instructions
Search Terraform for G-series values such as
Standard_G4in thesizeattribute ofazurerm_linux_virtual_machineandazurerm_windows_virtual_machine, and invm_sizeon the legacyazurerm_virtual_machineresource.Check shared modules,
.tfvarsfiles, and variable defaults. G-series sizes often sit in avariable "vm_size"default rather than the resource block.Map each G-series size to an Ev5 size by memory, using the table above as a starting point.
Measure how much of the local temp disk the VM actually uses (
/mntor/dev/sdbon Linux, theD:drive on Windows). Edv5 temp disks are less than half the size of G-series temp disks.Choose Ev5 for Linux VMs with all data on managed disks. Choose Edv5 for Windows VMs or any VM that uses its temp disk.
Confirm vCPU quota for the target family in the region. Azure assigns quota per VM family, and the Ev5 target needs twice the vCPU quota of the G-series size it replaces.
Change the
sizevalue and runterraform plan. Confirm the plan showssizeas an in-place update, not a resource replacement.Apply during a maintenance window. The G-series runs on older hardware clusters, so expect Azure to deallocate the VM during the resize.
Validate the workload, then add Infracost to CI/CD so new G-series sizes are flagged in pull requests before they merge.
Best Practices
Pin approved VM sizes in shared Terraform modules with a
validationblock, so G-series sizes fail atterraform plan.Migrate development and staging first. A processor change rarely breaks applications, but a deallocation and restart can surface boot or driver issues.
Copy anything stored on the G-series temp disk to a managed disk before resizing. Temp disk data does not survive a deallocation.
Check per-core software licensing before doubling vCPUs. If a license is billed per vCPU, a constrained vCPU size such as
Standard_E32-16ds_v5keeps 256 GiB of memory with 16 active vCPUs.Review reserved instances before migrating. Microsoft's modernization guide lists July 1, 2026 as the one-year reservation expiration for the G-series, so remaining G-series VMs fall back to pay-as-you-go pricing.
This policy is for workloads that need memory, not local storage. Workloads built around the G-series multi-terabyte SSD may fit the Lsv3 series better than Ev5.
Tools and Scripts
How does Infracost detect G-series sizes automatically?
The Azure G-series to Ev5 upgrade policy is available in Infracost, including in the free trial. When Infracost runs in CI/CD, it checks Azure virtual machine resources in each pull request. It flags G-series sizes in the PR comment, with the file and line to change.
The Infracost pull request comment also explains why the best practice matters. The engineer sees the reason before merge, not in a FinOps ticket after deployment.
When FinOps policies are enabled, Infracost also scans connected repositories for G-series sizes already in code. Platform and FinOps teams can burn down that backlog over time, tracking new issues prevented separately from existing issues fixed.
Teams can choose whether a failing pull request is blocked or only warns engineers. The message can also be customized to reference internal VM sizing standards.
To find G-series sizes in a Terraform codebase:
To list Azure virtual machines still on a G-series size with the Azure CLI:
This Azure CLI query excludes GS-series sizes, which a separate GS-series policy covers. If Terraform manages the VM, change size in code rather than in the Azure portal. Otherwise the next terraform apply restores the G-series size.
Examples of Impact
Savings from the Azure G-series to Ev5 upgrade are large per VM, because G-series list prices are more than double the Ev5 rate for similar memory.
Illustrative example: an in-memory cache tier. A platform team runs three Standard_G4 Linux VMs for an in-memory cache, with persistent data on managed disks. Moving them to Standard_E32_v5 one at a time cuts compute cost by about 54%, roughly $62,600 per year at East US 2 list prices.
Illustrative example: Windows analytics workers. A DevOps team runs Windows analytics workers on Standard_G3and uses the D: temp drive for intermediate files. The team moves to Standard_E16d_v5, which keeps a 600 GiB temp disk, after confirming the jobs never use more than that.
(These are illustrative scenarios, not specific customer accounts.)
Considerations and Caveats
The Azure G-series to Ev5 upgrade is low risk for memory-bound workloads, but local storage and licensing need attention.
Much smaller temp disks. Ev5 sizes have no local temp disk, and Edv5 temp disks are less than half the G-series size. Windows cannot resize directly between sizes with and without a temp disk.
Double the vCPUs. Matching G-series memory on Ev5 doubles the vCPU count, which affects quota and any per-core software licensing.
Fewer data disk slots.
Standard_G4andStandard_G5support up to 64 data disks, whileStandard_E32_v5andStandard_E64_v5support up to 32. Consolidate data disks before the move if a VM uses more than 32.Deallocation required. Changing
sizefrom a G-series VM typically deallocates it, which releases dynamic public IP addresses and clears the temp disk.Quota and reservations are per family. Request Ev5 or Edv5 vCPU quota before the migration window. Plan for G-series reservations to be exchanged or to expire.
Provider-specific. This policy targets Azure Virtual Machines through the
azurermprovider. AWS and Google Cloud memory-optimized instance generations use different names.
Related Policies and Concepts
Older Azure VM series rarely sit alone in a subscription, so these policies are usually worth enabling together.
Azure Virtual Machines - consider upgrading GS series machines to Esv5 or Mv3: the same upgrade for GS-series sizes with Premium SSD support.
Azure Virtual Machines - consider upgrading E series machines to Ev5: the policy for older memory-optimized E-series sizes that share the same Ev5 target.
Azure Virtual Machines - consider upgrading D series machines to Dv5: the general-purpose equivalent of moving off an older Azure VM series.
Azure Virtual Machines - consider upgrading Ls series machines to Lsv2: a related upgrade for storage-optimized VMs, relevant when a G-series workload depends on local storage.
Azure Virtual Machines - Consider using a preferred instance type: a Compute-group policy that restricts Azure VM sizes to an approved list, which can also block G-series sizes.
Frequently Asked Questions (FAQs)
Is this policy supported in Infracost?
Yes. The Azure G-series to Ev5 upgrade policy is supported in Infracost and available in the free trial. Infracost flags Azure virtual machine resources using a G-series size in pull requests, so the team can change the size before merge.
Can this policy be customized?
Yes. Teams can configure how Infracost enforces the Azure G-series to Ev5 upgrade policy. A failing pull request can be blocked or only warn engineers, and the message can reference internal VM sizing standards.
Does Infracost automatically fix violations?
No. Infracost reports each Azure G-series size in the pull request with the file and line to change. Choosing between Ev5 and Edv5 depends on whether the workload needs a local temp disk, so the team makes that decision.
Is this policy cloud-agnostic?
No. The Azure G-series to Ev5 upgrade policy targets Azure Virtual Machines through the azurerm Terraform provider. AWS and Google Cloud have their own memory-optimized instance generations, with different resource and attribute names.
Which Ev5 size replaces Standard_G4?
Standard_E32_v5, or Standard_E32d_v5 when the workload needs a local temp disk. Standard_G4 has 224 GiB of memory, so the closest Azure Ev5 replacement by memory is the 32-vCPU size with 256 GiB.
When will Azure retire the G-series?
Microsoft lists November 15, 2028 as the retirement date for the Azure G-series and GS-series. After that date, remaining Azure G-series VMs are deallocated and stop working.
How often should I review Azure VM series for upgrades?
Teams running Infracost in CI/CD get an Azure G-series check on every pull request that touches an Azure virtual machine resource. For existing Azure VMs, a quarterly review against Microsoft's retirement announcements is a reasonable cadence.
Create Free Account
This policy is supported in Infracost and available in the free trial. Sign up today and scan your code using our entire library of FinOps policies.