Amazon recently introduced the EC2 M7i-Flex instance, boasting superior performance and costs compared to its M6i instance predecessor. This introduction sparked speculation in the cloud community that the M7i-Flex instances might be positioned to replace the popular T series instances, given their similar use cases, enhanced performance, and lower cost compared to M6i instances.

Without Unlimited mode enabled T4g instances can provide 30-43% savings compared to the corresponding M7-Flex instance, though with potentially poor performance. With Unlimited mode enabled, the performance is not compromised, however, could be more expensive. We found 4% and 25% savings using M7i-Flex instances compared to T4g in Unlimited mode. Let’s delve into the key features of these General Purpose instances, compare them in various scenarios, and shed light on the potential cost savings that organizations can achieve.

M7i-Flex Instances

The M7i-Flex belongs to the latest generation of M series instances and is powered by the 4th Generation Intel Xeon Scalable processors. It has a 19% better price performance than its predecessor, the M6i, and a 5% better price performance than the M7i instances.

M7i-Flex stands apart from the rest of the fixed-performance M series instances because of its flex nature. The flex capability is similar to the T series burstable performance, with some users wondering why it wasn’t a part of the T series. However, there are some key differences between flex and burstable types, which we will delve into shortly.

T4g Instances

T4g are the latest instances in the burstable T series. They run on AWS Graviton2 processors with Arm Neoverse N1 cores. T4g instances offer a significant 40% better price performance than T3 instances and are known as the cheapest and highest CPU performer of the T series.

Use Cases for M7i-Flex and T4g

M7i-Flex and T4g instances have several use cases in common. Amazon recommends both for virtual desktops, microservices, databases, and applications. M7i-Flex is also recommended for application and web servers and batch workloads. T4g is also recommended for development environments and code repositories.

Flex vs Burstable Instances

The graph below shows an example of how many workloads only use a low-to-moderate amount of CPU with spikes in CPU utilization. Flex and burstable instance types address these workloads by providing a baseline of CPU performance with the ability to exceed or burst the baseline CPU.

Burstable CPU Common Workoads

Burstable CPU Common Workoad

M7i-Flex instances ensure a baseline of 40% CPU performance while having the ability to scale up to full CPU performance for 95% of the time throughout a 24-hour window. Note that instances consistently above the CPU for long periods could see a gradual reduction in “maximum burst CPU throughput.”

The baseline CPU performance of T4g large instances varies from 30-40%. It seems the main difference between flex and burstable is the use of CPU credits for burstable instances. In short, CPU credits are gained when the CPU usage is under the baseline and spent when CPU usage is over the threshold.

If you run out of credits, you are either capped under your baseline CPU performance (causing poor performance), or you can enable Unlimited mode. Unlimited mode is what it sounds like, unlimited CPU usage up to 100%; however, it comes at an additional cost.

M7i-Flex Pricing

Instance name On-Demand hourly rate vCPU Baseline Performance / vCPU Memory (GiB) Storage Network performance
m7i-flex.large $0.09576 2 40% 8 EBS Only Up to 12.5 Gigabit
m7i-flex.xlarge $0.19152 4 40% 16 EBS Only Up to 12.5 Gigabit
m7i-flex.2xlarge $0.38304 8 40% 32 EBS Only Up to 12.5 Gigabit
m7i-flex.4xlarge $0.76608 16 40% 64 EBS Only Up to 12.5 Gigabit
m7i-flex.8xlarge $1.53216 32 40% 128 EBS Only Up to 12.5 Gigabit

M7i-Flex Instance Details

T4g Pricing

Instance name On-Demand hourly rate vCPU Baseline Performance / vCPU Memory (GiB) Storage Network performance CPU Credits Earned Per Hour Maximum Earned Credits That Can Be Accrued
t4g.nano $0.0042 2 for a 1h 12m burst 5% 0.5 EBS Only Up to 5 Gigabit 6 144
t4g.micro $0.0084 2 for a 2h 24m burst 10% 1 EBS Only Up to 5 Gigabit 12 288
t4g.small $0.0168 2 for a 4h 48m burst 20% 2 EBS Only Up to 5 Gigabit 24 576
t4g.medium $0.0336 2 for a 4h 48m burst 20% 4 EBS Only Up to 5 Gigabit 24 576
t4g.large $0.0672 2 for a 7h 12m burst 30% 8 EBS Only Up to 5 Gigabit 36 864
t4g.xlarge $0.1344 4 for a 9h 36m burst 40% 16 EBS Only Up to 5 Gigabit 96 2304
t4g.2xlarge $0.2688 8 for a 9h 36m burst 40% 32 EBS Only Up to 5 Gigabit 196 4608

T4g Instance Details (scroll to see full table)

*Given that a CPU Credit represents the performance of a full CPU core for one minute, the maximum credit balance is converted to CPU burst minutes per day by dividing it by the number of vCPUs.

In Unlimited mode CPU Credits cost $0.04 per vCPU-Hour for Linux, RHEL, and SLES.

Scenarios: M7i-Flex vs T4g

When comparing costs, we can focus on the large, xlarge, and 2xlarge of the two instance types because they have the same vCPU and memory.

The cost of m7i-flex.2xlarge is 43% more than t4g.large. However, t4g.large has a 30% CPU baseline performance compared to the m7i-flex.2xlarge. The cost of the xlarge and 2xlarge are both 30% more expensive for M7i-flex.

So, T4g will be 30-43% cheaper if you do not use excess CPU Credits in Unlimited mode. However, if you run out of credits, your credit is capped at your baseline performance.

Breakeven CPU Usage Threshold: M7i-Flex vs T4g

To calculate when Unlimited mode will make T4g instances more expensive than M7i-Flex, we can calculate the breakeven CPU usage threshold. The breakeven CPU usage threshold refers to the point at which the cost of running M7i-Flex compared to T4g in unlimited mode breaks even.

Instance Type vCPUs T4g Price/Hour Corresponding M7i-Flex Price/Hour Price Difference T4g Baseline Utilization per vCPU (%) Charge per vCPU Hour For Surplus Credits Charge per vCPU Minute Additional Burst Minutes Available per vCPU Additional CPU % Available Breakeven CPU %
t4g.large 2 $0.0672 $0.09576 $0.02856 30% $0.04 $0.000667 42.82 36% 66%
t4g.xlarge 4 $0.1344 $0.19152 $0.05712 40% $0.04 $0.000667 85.64 36% 66%
t4g.2xlarge 8 $0.2688 $0.38304 $0.11424 40% $0.04 $0.000667 171.27 36% 66%

Breakeven CPU Threshold Calculations for M7i-Flex vs T4g (scroll to see full table)

If your average CPU usage (over 24 hours) is 66% or more, it is more cost-effective to use M7i-Flex instances.

Unlimited Mode Formulas Used

CPU Credits Earned Per Hour = (CPU amount * baseline performance % * 60 minutes) * CPU Credits Spent Per Hour

CPU Credits Spent Per Hour = CPU amount * % over baseline performance * 60 minutes

vCPU-hours = surplus credits / 60 minutes

Scenario 1

Let’s compare m7i-flex.large and t4g.large with Unlimited mode enabled while CPU usage fluctuates over five days. Note that t4g.large can earn 36 CPU credits per hour, and the maximum earned credits that can be accrued is 864.

  1. The instance is initialized and for the first 6-hour period remains idle, so CPU utilization is 0%. In that time, 216 credits are earned.
  2. The CPU usage for the next 3 hours increases to 60%. That uses half of your CPU credits, leaving you with a balance of 108 credits.
  3. For the next 6 hours, CPU utilization stays at 25%. 36 credits are earned. The balance is 144.
  4. Next, CPU utilization stays at 40% for 18 hours, using 216 credits. The credit balance is -72.
  5. For 12 hours, CPU utilization is at 30%. You neither gain nor lose credits.
  6. The CPU usage for the next 18 hours increases to 80%. That uses 1080 credits putting the balance to -1152.
  7. For the next 6 hours, CPU utilization stays at 25%. 36 credits are earned. The balance is now -1116.
  8. CPU usage goes back up to 55% for 24 hours. 720 credits are used. The balance is -1836.
  9. For 15 hours, CPU use is 75%. 630 credits are used and the balance is -2466.
  10. Finally, for 12 hours before the instance is stopped, the CPU uses 60%. 432 credits are used for a total of -2898 credits.

The CPU surplus credits charged is 2898, which corresponds to 48.3 vCPU-hours. From there, we can calculate the total cost:

48.3 vCPU-hours * $0.04 * 2 CPUs = $3.86

The charge for the 120 hours of the On-Demand hourly rate is:

$0.0672 * 120 hours = $8.07

So the total cost is $11.928 for t4g.large.

m7i-flex.large is much simpler to calculate:

$0.09576 * 120 hours = $11.49

m7i-flex.large provides a 4% savings in this case.

Scenario 2

Let’s do another example comparing m7i-flex.2xlarge and t4g.2xlarge with Unlimited mode enabled over 2 days. Note that t4g.2xlarge can earn 196 CPU credits per hour and the maximum earned credits that can be accrued is 4608.

  1. For the first 3 hours, the CPU usage is 90%. This uses 720 credits, making the balance -720.
  2. In the next 6 hours, CPU utilization decreases to 60%. 576 more credits are used, so the balance is -1296.
  3. CPU usage drops to 30% for 3 hours. 144 credits are gained and the balance is now -1152.
  4. For 12 hours, CPU utilization stays at 40%. No credits are gained or used so the balance remains the same at -1152.
  5. For 18 hours, the CPU utilization is at 50%. This uses 864 credits so the balance is -2016.
  6. Finally, for 6 hours, CPU use is 35%. 144 credits are gained and the balance is -1872.

The CPU surplus credits charged is 1872, which corresponds to 31.2 vCPU-hours. From there, we can calculate the total cost:

31.2 vCPU-hours * $0.04 * 8 CPUs = $9.99

The charge for the 48 hours of the On-Demand hourly rate is:

$0.2688 * 48 hours = $12.90

So the total cost is $22.89 for t4g.2xlarge.

m7i-flex.2xlarge is much simpler to calculate:

$0.38304 * 48 hours = $18.39

m7i-flex.2xlarge provides a 25% savings in this case.

Conclusion

The constant evolution of EC2 instance types with the introduction of the latest generation types alters how series compare. The comparison of M7i-Flex and T series is particularly interesting because of the similarities between flex and burstable types. M7i-Flex instances, with their excellent performance and high network performance, are a strong option for scenarios requiring sustained high CPU utilization.

On the other hand, T4g instances stand out for their extreme cost-effectiveness, particularly when workloads remain mostly under the baseline, avoiding additional charges in Unlimited mode. This makes T4g instances a compelling choice for environments where burstable performance is sufficient, and cost optimization is a critical consideration. However, it is important to consider your specific use case, since Unlimited mode could make T4g more expensive than M7i-Flex instances.