AWS Fargate vs EC2 Pricing Comparison: Who Wins the Pricing War?

AWS Fargate vs. EC2, which is the more cost-effective option? Let's find out in this comprehensive write-up on Fargate vs. EC2 pricing comparison.

July 15, 2022
7 mins read
Last Updated March 18, 2024
Fargate vs. ec2 pricing

AWS Fargate vs EC2 Pricing Comparison: Who Wins the Pricing War?

According to the Flexera state of the cloud report 2022, the cloud spending of a lot of organizations was over their budgeted expense. How to reduce spending on the cloud? One way to do so is to reduce the amount spent on different cloud services.

The $180 billion cloud market is currently dominated by Amazon who enjoys a 33% market share. Hence, if you are either using cloud or are planning to use cloud, then there is a high probability that you will be using AWS services. Compute is one of the most widely used AWS services and the cost of compute services will form a significant portion of your total cloud costs.

Fargate and EC2 are two of the most popular compute services provided by AWS. Many of our clients have a common question: Which is cheaper, Fargate or EC2? In this blog we do a Fargate vs. EC2 pricing comparison to find out the answer. Let’s begin!

Simform is one of the best cloud service providers in the industry. We are a Microsoft Gold partner and AWS Premier consulting partner. Allow our cloud experts to help you leverage the power of the cloud for your business. We will study your business, the market, and the customers you want to cater to and devise a customized cloud solution for your business.

Fargate vs. EC2 pricing structure

To conduct a more accurate Ec2 vs. Fargate pricing comparison, we will need some basic information regarding the pricing structures of Fargate and EC2. Therefore, here is a brief overview of the different pricing mechanisms of EC2 and Fargate.

Amazon EC2 pricing model

Here are the different tiers in the Amazon EC2 pricing model.

Amazon EC2 free tier

AWS provides free access to the Linux, SLES, Windows, and RHEL EC2 micro instances for 750 hours every month. In addition, the company provides t3 micro instances in the regions where the t2 micro instances access is unavailable.

Amazon EC2 On-Demand

In this model, you need to pay only for the instances you run. You can dynamically increase or decrease your compute capacity depending upon your requirements. The AWS EC2 pricing depends on

  • Region
  • Number of vCPUs
  • Instance type
  • Spot instances
  • Operating system

AWS spot pricing is designed to give customers access to spare computing capacity at a significant discount compared to On-Demand prices.

You can get the spare EC2 computing capacity at 90% off the on-demand price. The Spot Instances service is particularly useful when you need extra EC2 capacity to handle a burst in activity and need it right away.

Amazon EC2 reserved instances

With the AWS EC2 reserved instances, you can save a significant amount of money compared to the on-demand instances. The AWS EC2 instances also allow you to go for capacity reservation when you use it in a certain availability zone.

AWS provides two types of reserved instances

  • Standard reserved instances
  • Convertible reserved instances

Depending upon the time duration of your contract, you can get the following discount in reserved instances compared to the on-demand instances.

Time duration Standard instances Convertible instances
One year Up to 40% Up to 31%
Three year Up to 60% Up to 54%

Choose standard or convertible reserved instances depending on your specific requirements and avail heavy discounts compared to on-demand instances.

Savings plan

AWS also offers savings plans for EC2 and Fargate. These savings plans allow the users to avail of low prices by committing to a consistent amount of usage for a fixed period. The period is usually 1-3 years.

There are three types of savings plans.

  • Compute Savings Plans
  • EC2 Instance Savings Plans
  • Amazon SageMaker Savings Plans

 

Time duration EC2 savings plan Amazon SageMaker savings plan
1-3 year term Up to 72% Up to 64%

If you have a fixed requirement and can plan, it is best to go with the savings plans. The savings plans will help you save a considerable amount of money.

Dedicated hosts

The dedicated hosts allow you to use your existing software licenses like SQL Server, SUSE Linux Enterprise Server, and Windows Server. It can be up to 70% cheaper compared to on-demand instances.

How does AWS Fargate Pricing work?

Now that we’ve looked at how Amazon EC2 pricing works, let’s see how AWS Fargate pricing works.

The AWS Fargate pricing depends on the five dimensions.

  • vCPU
  • Memory requirements
  • Operating Systems
  • CPU Architecture
  • Storage requirements

The pricing is calculated from the time you download the container image till the Amazon ECS task or EKS pod terminates operations. The pricing is calculated for a minimum of 1 minute for Linux systems while for a minimum of 15 minutes for Windows systems. The prices are rounded to the nearest second.

For example, let us take the U.S. West( N. California) case for pricing and the following parameters.

Operating system Linux
CPU Architecture x86
Memory requirements 4 GB
Number of vCPUs 2
Storage requirements 20 GB

Now, if we assume that your application will need to run 1 task per hour, these will be the pricing calculations.

Number of tasks or pods: 1 per hour * (730 hours in a month) = 730 per month

  • 730 tasks x 1 vCPU x 15 hours x 0.04656 USD per hour = 509.83 USD for vCPU hours
  • 730 tasks x 4.00 GB x 15 hours x 0.00511 USD per GB per hour = 223.82 USD for GB hours
  • 20 GB – 20 GB (no additional charge) = 0.00 GB billable ephemeral storage per task

509.83 USD for vCPU hours + 223.82 USD for GB hours = 733.65 USD total

Total Fargate cost on a monthly basis for a Linux system- 733.65 USD

Note that for every 1 GB of storage required over the free 20 GB, you will need to pay per storage GB per hour $0.000111.

What if we tweak it and change the operating system to Windows? For the same parameters mentioned above the cost of a Windows-based system will be

Total Fargate cost on a monthly basis for a Windows-based system- 2,161.86 USD

That is a 2.95X increase from the Linux operating system cost. You can see how the cost drastically changes when you change the operating system. You can save money on Fargate plans by availing of the savings plan provided by AWS.

Understand that using the AWS Fargate savings plan is economically viable only when you have a fixed amount of Fargate usage. You can pre-commit a specific dollar amount for a one to a three-year term and save up to 50% on your Fargate billing. We can see that, as compared to EC2, AWS Fargate pricing is pretty simple.

At Simform, we have a team of AWS experts who will help you select the best pricing structure for Fargate and Amazon EC2, depending on your project requirements. As a result, we will help you save dollars without affecting the performance of your system.

Fargate vs. EC2 pricing comparison

Is Fargate more expensive than EC2? This is the question most of our clients ask us.

In most cases, AWS Fargate is more expensive than Amazon EC2. Therefore, you need to know the premium you are paying for Fargate relative to EC2 instances. For our Fargate vs. EC2 cost comparison, we have compared the pricing of popular EC2 instances with equivalent Fargate systems.

For all the AWS Fargate vs. EC2 pricing comparison cases mentioned below, the prices are for the us-east-1 region. Linux is the operating system, x86 is the CPU architecture, and 20 GB storage requirement. The Fargate vs. EC2 price comparison is for on-demand pricing.

Compute-optimized instances

The C5 instances are designed for processing compute-heavy applications like

  • High-performance computing(HPC)
  • Scalable multiplayer gaming
  • Distributed analytics
  • Ad serving
  • Batch processing

Example

Businesses like iPromote, which provide digital advertising solutions to around 40,000 small and medium-sized businesses, use C5 instances. Understand that to cater to such a large client base, you will need to process billions of ad-serving bid transactions daily. The C5 instance is best for handling such heavy workloads.

For comparison, we take the c5.xlarge instance. It has 4vCPUs and 8GB of RAM. But, first, let’s compare the EC2 on-demand hourly pricing and Fargate pricing.

EC2 hourly pricing Fargate hourly pricing Difference
$0.17 $0.19 Fargate is 16% costlier compared to EC2

AWS considers 730 hours in a month. So for a single task, you will pay

$0.17X730= $124 per month for EC2

$0.19748X730=$144 per month for Fargate

General-purpose instances

Let’s have a look at a general-purpose instance, M5. The M5 is a family of general-purpose instances that offer a balance between

  • Networking resources
  • Compute resources
  • Memory

You can use the M5 instances for a broad range of applications like

  • Small and mid-sized databases
  • Gaming servers
  • Cluster computing
  • App development environments
  • Caching fleets
  • Web and application server

Example

Airnguru, one of the leading SaaS solutions providers to airlines, is a classic example of a business that has tasted success with M5 instances in EC2.

Cesar Moltedo quote AWS EC2 instance Airnguru

Let’s compare the Fargate vs. EC2 pricing for a popular general-purpose instance, the m5.xlarge, which has 4vCPUs and 16GB of RAM.

EC2 hourly pricing Fargate  hourly pricing Difference
$0.192 $0.233 Fargate is 21% costlier compared to EC2

 

AWS considers 730 hours in a month. So for a single task, you will pay

$0.192X730= $140 per month for EC2

$0.233X730=$170 per month for Fargate

Burstable instances

The T3 instances are low-cost general-purpose instances that can burst CPU usage at any time. Therefore, you can use T3 instances in applications that require moderate CPU usage and experience only temporary spikes in usage. T3 instances are best suited for the following workloads.

  • Large-scale microservices
  • Small and medium databases
  • Business-critical applications
  • Virtual desktops
  • CI servers
  • Email sending applications
  • Test environments
  • Code repositories

Example

If your workload consists of handling public-facing HTTP APIs, then T3 instances are best for handling your workload. This is because a public-facing HTTP API needs to have a spare CPU capacity to handle the spikes in traffic. But, how much headroom to keep? Well, this depends on the type of API. At Simform, we try to keep on an average 100% extra headroom whenever we build such an API. The idea is that the system should be able to handle a sudden 2X traffic hike with ease.

Let’s compare the EC2 vs. Fargate cost of a popular instance, the t3.xlarge, which has 4vCPUs and 16GB of RAM. Let’s compare the pricing for EC2 on-demand hourly pricing and Fargate pricing.

EC2 hourly pricing Fargate hourly pricing Difference
$0.1664 $0.233 Fargate is 40% costlier compared to EC2

 

AWS considers 730 hours in a month. So for a single task, you will pay

$0.1664X730= $121 per month for EC2

$0.233X730=$170 per month for Fargate

Ec2 vs. Fargate use cases

Both EC2 and Fargate are beneficial for select situations. Let’s discuss when to use EC2 and when to use Fargate.

When to use EC2?

The following are the use cases for EC2.

Ec2 is more economical for predictable steady-state workloads with higher CPU and memory usage. This is because, with EC2, you won’t incur additional charges for using ECS even if you choose to use your EC2 instances.

If you have purchased reserved instances with long-term ownership commitments, then EC2 can be a good option. This is because, in most cases, you will have existing EC2 hardware that you can leverage to run containers.

Ec2 is a better choice if, due to your company policies or due to compliance issues, you need more control over your system.

Ec2 can cater to your unique requirements like running machine learning tasks. That’s why if you have Machine Learning workloads, it is better to go with EC2.

Waypoint is a platform that allows music lovers to enjoy live concerts hassle-free. The client approached Simform to build a robust mobile app catering to millions of participants. Our expert team eliminated manual intervention regarding increasing or decreasing the server capacity. We did this by deploying auto-scalable Amazon EC2 instances.

When to use Fargate?

The following are the use cases for AWS Fargate

Ec2 does not provide vCPU offerings with less than 1 CPU, while Fargate offers you a 0.25 vCPU. Hence if your workload does not demand heavy CPUs, it’s better to go with Fargate as it is a more cost-effective option in such scenarios.

With Fargate, AWS  automatically provisions your system, eliminating the fear of over and under-provisioning. Hence if you want to remove over and under-provisioning, go for Fargate.

Fargate proves to be a great choice if your application consists of variable workloads. This is because, with Fargate, you only pay for the amount of resources you provision.

Fargate is better than EC2 in terms of flexibility. However, there is no long-term commitment to the resources you have provisioned. Hence if you require flexibility, then go for Fargate.

One of Simform’s clients, a recruitment platform, wanted to modernize its existing infrastructure. The client also needed a high degree of flexibility. The Simform engineers decided to employ AWS Fargate to provide this flexibility. The platform was able to handle even a sudden 10X increase in traffic.

For more detailed use cases for AWS Fargate

Fargate vs. EC2, which is better?

Fargate is more expensive than EC2 when running the same workloads in most cases. However, there are ways to optimize AWS Fargate costs that make Fargate significantly cheaper. But cost should not be the only deciding factor. You should also consider your specific use case to select the best option.

At Simform, we are an  AWS Premier Consulting Partner. Our expert AWS consultants will help you select the best option for your business by analyzing your specific requirements. We at simform not only focus on optimizing costs but also prioritize evaluating  Fargate vs. EC2 performance concerning your use case. Speak to our experts today and get a free consultation for your project.

cloud cost optimization best practices

Cloud cost optimization

Hiren is VP of Technology at Simform with an extensive experience in helping enterprises and startups streamline their business performance through data-driven innovation.

Your email address will not be published.

Get insights on Gen AI adoption and implementation in 2024. Download the survey report now!

Download Now