Skip to main content
emnode / learn
Cost

Upgrade EC2 instances to the newest generation

Each new EC2 generation is cheaper per vCPU and ~10-20% faster — Cost Optimization Hub surfaces the no-downside swaps. Apply them.

14 min·10 sections·AWS

Last reviewed

Generation upgrades: the basics

What does it mean to upgrade an EC2 instance generation?

AWS releases a new EC2 generation roughly every 18-24 months. The naming scheme tells the story: m4 → m5 → m6i → m7i for Intel general-purpose, c4 → c5 → c6i → c7i for compute-optimised, r4 → r5 → r6i → r7i for memory-optimised. There's a parallel AMD line (m5a, m6a, m7a) and the Arm-based Graviton line (m6g, m7g) — but a generation upgrade in this lesson means staying on the same architecture and stepping forward inside the Intel or AMD family.

Each generation does two things at once: lowers the hourly rate by 5-10% versus the previous one and delivers 10-20% better per-vCPU performance from a newer Xeon or EPYC chip, plus a faster Nitro hypervisor, faster networking (ENA), and faster EBS bandwidth. Net effect: you pay less for an instance that runs your workload faster. The AMD variants (m6a, m7a) are typically another ~10% cheaper than the Intel equivalents for workloads that don't depend on Intel-specific instructions.

An out-of-date fleet — anything still on m4, c4, r4, or even m5 — is paying the legacy tax. Cost Optimization Hub surfaces these as an Upgrade EC2 instance action with the current type, the recommended type, and projected monthly savings. Unlike right-sizing, the workload doesn't have to be over-provisioned; the recommendation appears purely because a newer generation in the same family-and-size is cheaper and faster.

In this lesson you'll learn how to read a Cost Optimization Hub Upgrade:Ec2Instance recommendation, what compatibility checks actually matter for an x86 → x86 generation jump, and how to apply the change safely — both for single instances and for ASG-managed fleets. You'll also see how Reserved Instances and Savings Plans interact with the upgrade, and how to avoid stranding commitments on the old generation.

Fun fact

The free 15% upgrade nobody applies

AWS published benchmark data showing m6i delivering ~15% better integer throughput than m5 at a 5% lower hourly rate — a 20-point swing in price/performance that requires no code change, no architecture change, and an identical AMI in 99% of cases. Internal AWS data shared at re:Invent suggests fewer than 40% of customer instances are on the latest generation in their family eighteen months after release. The block on the upgrade is almost never technical; it's that nobody is paid to go look.

Generation upgrade in action

Marco runs platform infrastructure at a logistics SaaS. The monthly FinOps review surfaces 38 instances still on m5.2xlarge across three production services. They were picked when the cluster was first stood up in 2022 and never touched since.

Cost Optimization Hub is recommending Upgrade:Ec2Instance on every one of them — current type m5.2xlarge, recommended type m7i.2xlarge, projected savings $1,640/month at the fleet level. He spot-checks one: same vCPU count, same RAM, same architecture (x86_64), same network bandwidth class. The AMI is Amazon Linux 2023, which already ships an ENA driver new enough for the m7i family.

He decides to upgrade the ASG-managed services via launch-template versioning, and the two standalone bastion-style boxes via stopmodify-instance-attributestart. The whole change is scheduled for the next maintenance window with a documented rollback path back to the previous launch-template version.

First, pull the Cost Optimization Hub recommendations for the account to see the upgrade candidates.

$ aws cost-optimization-hub list-recommendations --filter 'actionTypes=Upgrade,resourceTypes=Ec2Instance' --query 'items[].{Id:recommendationId,Current:currentResourceSummary,Recommended:recommendedResourceSummary,Savings:estimatedMonthlySavings}'
[
{
"Id": "r-0a1b2c3d4e5f",
"Current": "m5.2xlarge",
"Recommended": "m7i.2xlarge",
"Savings": 43.18
},
{
"Id": "r-1f2e3d4c5b6a",
"Current": "c5.4xlarge",
"Recommended": "c7i.4xlarge",
"Savings": 78.94
}
]
# Same family, same size — drop-in upgrades with no architecture change.

Cost Optimization Hub flagging two upgrade candidates with their projected monthly savings.

Cross-check with Compute Optimizer to confirm there are no performance-risk surprises on the recommended type.

$ aws compute-optimizer get-ec2-instance-recommendations --instance-arns arn:aws:ec2:eu-west-1:123456789012:instance/i-0abc123def456 --query 'instanceRecommendations[0].recommendationOptions[?instanceType==`m7i.2xlarge`] | [0]'
{
"instanceType": "m7i.2xlarge",
"performanceRisk": 1.0,
"migrationEffort": "VeryLow",
"projectedUtilizationMetrics": [
{ "name": "CPU", "statistic": "Maximum", "value": 38.4 },
{ "name": "Memory", "statistic": "Maximum", "value": 51.2 }
],
"savingsOpportunity": { "savingsOpportunityPercentage": 8.7, "estimatedMonthlySavings": { "value": 43.18, "currency": "USD" } }
}
# migrationEffort VeryLow + performanceRisk 1.0 — apply with confidence.

Compute Optimizer confirms the m5 → m7i jump is a low-effort, low-risk swap.

Generation upgrades under the hooddeep dive

Every EC2 generation past m5 runs on the Nitro hypervisor — a thin, hardware-offloaded virtualisation layer that gives the guest near-bare-metal performance and a stable device interface. This is why the upgrade tends to be a clean swap: the Nitro contract is the same across m5, m6i, and m7i, so an AMI built for one usually boots on the others without driver changes. The exception is older AMIs (pre-2020) that pinned the ENA driver to a specific version — those need an updated driver before the new instance will see its NICs, or the boot fails in a confusing way.

Pricing per vCPU drops monotonically across generations because AWS amortises the hardware cost across a denser fleet. An m7i.2xlarge has the same 8 vCPU / 32 GiB shape as an m5.2xlarge, but the underlying host is a 4th-gen Intel Xeon (Sapphire Rapids) running more instances per physical socket. AWS passes ~5% of that density gain through as a price cut, and the 10-15% IPC improvement is yours for free. AMD variants (m6a, m7a) typically price ~10% below the Intel equivalent in the same generation because EPYC chips offer more cores per socket.

The change itself depends on how the instance is managed. For an EBS-backed standalone box, the workflow is stopmodify-instance-attribute --instance-typestart — a 30-90 second outage. For ASG/EKS-managed fleets, you create a new launch-template version with the upgraded InstanceType, mark it $Default, and either trigger an instance-refresh (ASG) or update-nodegroup-version --force-update (EKS) to roll the fleet one node at a time. Spot fleets get the upgrade for free on the next interruption — newer generations generally have better Spot availability and lower interrupt rates because the underlying capacity pool is larger.

# Single instance: brief outage to swap the type.
aws ec2 stop-instances --instance-ids i-0abc123def456
aws ec2 wait instance-stopped --instance-ids i-0abc123def456

aws ec2 modify-instance-attribute \
  --instance-id i-0abc123def456 \
  --instance-type '{"Value":"m7i.2xlarge"}'

aws ec2 start-instances --instance-ids i-0abc123def456

# ASG-managed: roll the fleet via launch-template + instance refresh.
aws ec2 create-launch-template-version \
  --launch-template-id lt-0abc123def456 \
  --source-version '$Latest' \
  --launch-template-data '{"InstanceType":"m7i.2xlarge"}'

aws ec2 modify-launch-template \
  --launch-template-id lt-0abc123def456 \
  --default-version '$Latest'

aws autoscaling start-instance-refresh \
  --auto-scaling-group-name workers-prod \
  --preferences '{"MinHealthyPercentage":90,"InstanceWarmup":300}'

What is the impact of staying on old generations?

The direct cost is the simplest to quantify. A 1,000-instance fleet still on m5 when m7i is available is overpaying by roughly 8-10% on the hourly rate alone — that's $90-150k/year for a mid-sized SaaS. Add the performance improvement (you could run the same workload on a smaller m7i and save another ~10%) and the gap widens to 15-20% of fleet spend left on the table every month.

The second-order impact is committed-spend distortion. If you sign a 1-year EC2 Instance Savings Plan or family-locked RI on m5, those commitments only apply to the m5 family — they don't transfer to m6i or m7i. A team that commits aggressively to the wrong generation finds itself locked in: upgrading would strand the discount, but staying on m5 means missing 15% of the savings. The clean answer is Compute Savings Plans, which cover any instance family in any region, including the newer generations as they ship — and to upgrade before committing, not after.

There's also a Spot dimension. Newer generations have larger, deeper capacity pools because they're the host type AWS is actively building out. m7i Spot prices are typically 5-10% lower than m5 Spot, and the interruption rate is meaningfully better — AWS preferentially reclaims older capacity to consolidate fleets on newer hosts. Workloads that lean on Spot pay an invisible tax by staying on legacy generations: more interruptions, worse pricing, smaller pool to draw from.

Finally, there's the slow-burn risk of deprecation. AWS doesn't formally retire generations but capacity in popular regions thins out — m4 and c4 are now hard to launch on-demand in some regions, and Compute Optimizer flags them as Underprovisioned by default because the underlying hardware is genuinely slower. Staying on a generation more than two steps behind current is an unforced reliability risk.

How do you upgrade safely?

Generation upgrades are the easiest cost-perf win in AWS, but only if you run them as a continuous process rather than a one-off project. Four steps, each cheap; the cost is in skipping any of them.

1. Inventory by generation, not just by family

Pull every running instance and group it by family generation (m4 vs m5 vs m6i vs m7i). Anything more than one generation behind current is a candidate. The Cost Optimization Hub Upgrade:Ec2Instance recommendation list gives you this view directly, with per-instance projected savings. Treat instances older than two generations as a reliability concern, not just a cost one.

2. Verify AMI compatibility before rolling

For most modern AMIs (Amazon Linux 2, Amazon Linux 2023, Ubuntu 20.04+) the upgrade is a pure drop-in. The compatibility check is the ENA driver version — older custom AMIs may pin a driver too old for m6i/m7i NICs. Test on a single instance in a non-prod environment first, confirm boot and NIC enumeration, then roll. If the AMI is too old, bake a new one before the fleet upgrade.

3. Use launch templates and instance-refresh, never console clicks

ASG-managed fleets must be upgraded via a new launch-template version — a console-edited instance type doesn't survive the next replacement and silently reverts. Standalone instances can be done with modify-instance-attribute between stop/start. For RDS the equivalent is ModifyDBInstance with --apply-immediately false so the change waits for the maintenance window.

4. Prefer Compute Savings Plans over family-locked RIs

If you're going to commit, use Compute Savings Plans — they apply to any instance family, any generation, any region, and they don't strand when you upgrade. EC2 Instance Savings Plans and Standard RIs are locked to a family-and-region pair, so an m5 commitment doesn't cover the m6i you upgrade to. Right-size, upgrade generation, then commit — in that order.

# List every running instance grouped by family generation.
aws ec2 describe-instances \
  --filters Name=instance-state-name,Values=running \
  --query 'Reservations[].Instances[].[InstanceId,InstanceType]' \
  --output text \
  | awk '{ split($2,a,"."); print a[1] }' \
  | sort | uniq -c | sort -rn

# Anything in m4/m5/c4/c5/r4/r5 is a candidate. Cross-check with the Hub.

Quick quiz

Question 1 of 5

Cost Optimization Hub recommends upgrading an ASG of 12 m5.xlarge instances to m6i.xlarge, with projected savings of $310/month and migrationEffort: VeryLow. You have an EC2 Instance Savings Plan covering the m5 family in this region. What's the right move?

You've completed Upgrade EC2 instances to the newest generation. You now know how to read a Cost Optimization Hub upgrade recommendation, when an x86 → x86 generation jump is a pure drop-in versus when it needs an AMI refresh, and how to roll the change safely across single instances and ASG-managed fleets without stranding your Savings Plans. Inventory, verify, roll, commit — in that order, and on a quarterly cadence.

Back to the library