AWS Fargate cost optimization by using ARM CPU architecture

A

Hi, DevOps fans

At current article I will try to answer how much AWS Fargate costs. And to understand it better we will compare Fargate cost with EC2 service. If you will open aws pricing calculator, and choose AWS Fargate service, 1 task with 1 CPU x86 architecture to be running, and 2 GB RAM – you will see that price per month on demand will be – 40.88 USD

Let’s find out where that price comes from – as it is essential aspect

So, we have next calcualtions:

0.04656 per vCPU per hour × 1 CPU × 24 hours × 30 days = 33,5232 USD
0.00511 per GB per hour × 2 GB RAM × 24 hours × 30 days = 7,3584 USD
33,52 + 7,35 = 40.88 USD

Please, pay attention how much more CPU is expensive over memory. For comparison from EC2 side I will choose t3a.small instance, which has 2CPU and 2Gb RAM. If we will choose on demand option and add 20GB of disk space, then we will get 17.67 USD:

Which gives as:

40.88/17.67  -> 2.3 ratio

And that is taking into consideration that EC2 instance has 2 CPU – not one! The deal is that it is simply not possible to find the same configurations of CPU and memory, don’t you find it to be strange? But it is not the final cost, there are several options we can use to decrease current cost.

AWS proposes to us 2 architecture options:

  • X86
  • ARM

AWS offers ARM-based instances using their custom Graviton processors. These instances are designed to provide high performance at a lower cost. It is because ARM architecture is much more energy efficient than x86. Let’s change the existing x86 option at arm – as you see it looks much better.

So, we have 32.71 instead of 40.88 USD. Though there is one problem with that – not every application can be run on arm. Docker image should be built with a special architecture flag, and you need to test your application properly after that. Here is how you can do it.

OK, we already know that the ARM solution is cheaper, but it is even cheaper if you dig up the details. 

Please, pay attention to that phrase: “Fargate Spot and Compute Savings Plans are currently not supported on the AWS Pricing Calculator.”:

Let’s open interesting page from aws docs. If you will choose compute saving plan for Fargate with 1 year upfront payment, then you will see that X86 architecture give us 22% discount:

But in case ARM 64 – it looks even better:

Let’s calculate final price for AWS Fargate 1CPU, 2GB RAM, with 1 year saving plan using ARM CPU architecture

0.02738 per vCPU per hour × 24 hours × 30 days = 19,7136 USD
0.003 per GB per hour × 24 hours × 30 days × 2 GB = 4,32
Which give us 24 USD per month

But let’s choose optimal upfront plan for EC2 accordingly – otherwise it would not be fair comparison. Price for t3a.small EC2 instance with 1 year upfront payment using EC2 saving plan will be:

111.25 regular year price for EC2 + 1,90 USD for 20GB of disk space × 12 months = 134,05 USD for 1 year 
Which gives us 11.17 USD per month

So, final ration at Fargate/EC2 cost would be:

24/11.17 = 2.15 versus initial 2.3

And it appeared that our comparison price ratio improved, but we can do more. Let’s continue our investigation at next article (link will appear here when article would be ready).

If you are not ready to wait, or prefer to pass all material in a fast and more convenient way – then welcome to my course, were you can pass all material in a fast and convenient way. Here you can find coupon with discount, which I am updating regularly in the middle of every month.






architecture AWS cluster cyber-security devops devops-basics docker elasticsearch flask geo high availability java machine learning opensearch php programming languages python recommendation systems search systems spring boot symfony