Recently upgraded ufo to add support for ECS Fargate. As part of this, I had a chance to look at the pricing for Fargate. Found out that ECS Fargate’s pricing is competitive to Heroku’s offering. The pricing makes a lot of sense because they offer a similar value proposition. We do not have to manage the servers.
The benefits of ECS Fargate and Heroku can make a lot of sense for folks with limited DevOps resources, don’t need access to the container, and don’t want to manage, maintain and patch the server cluster.
I put together a list to compare. I tried choosing the cheapest cost option with the closest specs as possible. For spot instances, you usually can save 60%-90%. For simplicity, I’m assuming the spot price is 20% of on-demand pricing.
|Heroku||ECS Fargate||EC2 On-demand||EC2 Spot (20%)|
|Standard 1X 0.5GB 1CPU $25/mo||0.5GB 1CPU $31/mo||t3.nano 0.5GB 2CPU (burst) $3.80/mo||t2.nano 0.5GB 2CPU (burst) $0.76/mo|
|Standard 2X 1GB 2CPU $50/mo||1GB 2CPU $32/mo||t3.micro 1GB 1CPU (burst) $7.59/mo||t2.micro 1GB 1CPU (burst) $1.52/mo|
|Performance M 2.5GB 100% CPU $250/mo||2.5GB 2CPU $66/mo||t3.small 2GB 2CPU $15/mo||t3.small 2GB 2CPU $3/mo|
|Performance L 14GB 100% CPU $500/mo||2.5GB 4CPU $125/mo||t3.medium 4GB 2CPU (burst) $30/mo||t3.medium 4GB 2CPU (burst) $6/mo|
|14GB 4CPU $161/mo||c5.large 4GB 2CPU $62/mo||c5.large 4GB 2CPU $12/mo|
|14GB 8CPU $278/mo||c5.xlarge 8GB 4CPU $124/mo||c5.xlarge 8GB 4CPU $25/mo|
|m5.xlarge 16GB 4CPU $140/mo||m5.xlarge 16GB 4CPU $28/mo|
|c5.2xlarge 16GB 8CPU $248/mo||c5.2xlarge 16GB 8CPU $50/mo|
- NOTE: These prices were updated on 12/12/2021
As we can see above, the different offerings have various pricing options which make it a bit hard to compare. We’ll try to “standardize” these numbers to help make decisions. Hopefully, it gives us a ballpark pricing sense.
We’ll do our best to figure out some standard options, taking the instances with the closest comparable memory and CPU. For example, a 2.5GB RAM machine doesn’t exist, but a 4GB does. We’ll use the
t2.medium instance at an on-demand cost of $34/mo. We are choosing the $34/mo
t2.medium instance over the comparable $62/mo
c5.large because that’s what likely would be tried first in real life. We’ll also make some assumptions of what Heroku 100% CPU means and be on the generous side there. This is a bit of guesswork and not an exact science, but it’s valuable.
|Standard||Heroku||ECS Fargate||EC2 On-Demand||EC2 Spot (20%)|
As you can see, there can be a considerable cost difference between the setups. Most of the BoltOps infrastructure internally leverages spot instances for this reason, which can take your AWS bill down 80%. It is pretty obtainable to run a highly available infrastructure on spot instances to cash in on these savings, if you’re interested in learning more, check out: BoltOps Learn videos on Spot.
Here’s a chart at the 14GB 8CPU level:
If you want a more detailed spot pricing comparison, check out On-Demand vs Reserved vs Spot AWS EC2 Pricing Comparison.
Not Apples to Apples
It’s worth pointing out that these offerings are not an apples-to-apples comparison.
- Heroku has some of the most powerful tooling on the planet which makes it very convenient and easy for developers who quickly want to get something up. Heroku provides the cool heroku cli tool.
- ECS Fargate is a similar managed or “serverless” offering as Heroku but it’s tooling is closer to the ground level, which gives you more access and control in some ways. ECS offers the aws ecs cli command. Also, tools like ufo provide a interface on top of the aws-sdk.
- ECS with EC2 instances provides even more access and control to the host instance itself. This is great if you want or need to debug the host or container environment.
- ECS on top of EC2 Spot instances provides a ridiculously low-cost option.
The pricing above assumes that the resources are continuously running at all times. A kicker about Heroku and Fargate is the ability to run one-off tasks. So if you do not need to run a server continuously and just need to run a single job or task, this can make the pricing extremely attractive. Here’s what pricing would look like for a job that takes an hour.
|0.5GB 1CPU||3.5 cents/hr||4.3 cents/hr|
|1GB 2CPU||6.9 cents/hr||4.5 cents/hr|
|2.5GB 4CPU||35 cents/hr||17 cents/hr|
|14GB 8CPU||69 cents/hr||39 cents/hr|
Another way to think about it - a 10-minute job on a 1GB 2CPU machine will cost you about a penny. The pricing scheme provides a cool low-cost job processing option. Here are different ways to run one-off tasks:
- heroku run - The
heroku runcommand allows you to run a one-off command in an heroku environment or an app.
- aws ecs run-task - Allows you to run a one-off task with a pre-registered ECS task definition.
- ufo task - Tools like ufo can simplify the process. The
ufo taskcommand builds the docker image, registers the ECS task, and runs the command - all in one go.
Prices with cloud infrastructure change rapidly, so take these numbers with a grain of salt. They’ll likely change by the time you’ve read this article. The comparison can be helpful to provide a gut ballpark feel on pricing. Hope this helps 😁
Thanks for reading this far. If you found this article useful, I'd really appreciate it if you share this article so others can find it too! Thanks 😁 Also follow me on Twitter.
Got questions? Check out BoltOps.
You might also like
Kubes: Kubernetes Deployment Tool
Kubes is a Kubernetes Deployment Tool. It builds the docker image, creates the Kubernetes YAML, and runs kubectl apply. It automates the deployment process and saves you precious finger-typing energy.
Jets: The Ruby Serverless Framework
Ruby on Jets allows you to create and deploy serverless services with ease, and to seamlessly glue AWS services together with the most beautiful dynamic language: Ruby. It includes everything you need to build an API and deploy it to AWS Lambda. Jets leverages the power of Ruby to make serverless joyful for everyone.
Lono: The CloudFormation Framework
Building infrastructure-as-code is challenging. Lono makes it much easier and fun. It includes everything you need to manage and deploy infrastructure-as-code.