Recently upgraded ufo to add support for ECS Fargate. As part of this, I had a chance to take a 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 closest specs as possible. For spot instances, you usually can save 50%-90%. For simplicity, I’m assuming 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 $41/mo||t2.nano 0.5GB 1CPU (burst) $4.23/mo||t2.nano 0.5GB 1CPU (burst) $0.85/mo|
|Standard 2X 1GB 2CPU $50/mo||1GB 2CPU $46/mo||t2.micro 1GB 1CPU (burst) $8.47/mo||t2.micro 1GB 1CPU (burst) $1.69/mo|
|Performance M 2.5GB 100% CPU $250/mo||2.5GB 2CPU $96/mo||m1.small 1.7GB 1CPU $32/mo||m1.small 1.7GB 1CPU $6.40/mo|
|Performance L 14GB 100% CPU $500/mo||2.5GB 4CPU $169/mo||t2.medium 4GB 2CPU (burst) $34/mo||t2.medium 4GB 2CPU (burst) $6.80/mo|
|14GB 4CPU $274/mo||c5.large 4GB 2CPU $62/mo||c5.large 4GB 2CPU $12/mo|
|14GB 8CPU $419/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 taken on 4/22/2018. Prices change all the time and are probably going to be different by the time you read this.
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. Choosing the $34/mo
t2.medium instance over the comparable $62/mo
c5.large because that’s 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 I think it is 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 leverage spot instances for this reason. Also, was able to take a company’s AWS bill down 75% and saved over $100k a year.
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 lightweight 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||5.7 cents/hr|
|1GB 2CPU||6.9 cents/hr||6.4 cents/hr|
|2.5GB 4CPU||35 cents/hr||23.5 cents/hr|
|14GB 8CPU||69 cents/hr||58 cents/hr|
Another way to think about it - a 10-minute job on a 1GB 2CPU machine will cost you 1 penny, literally. 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 when used relatively though can be helpful to provide a gut ballpark feel on pricing. Hope this helps 😁