Heroku vs ECS Fargate vs EC2 On-Demand vs EC2 Spot Pricing Comparison

Tung Nguyen
BoltOps
4 min readApr 22, 2018

--

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.

Comparison List

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 60%-90%. For simplicity, I’m assuming spot price is 20% of on-demand pricing.

  • NOTE: These prices were updated on 7/17/2018.

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 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 I think it is valuable.

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, which can take your AWS bill down 80%. It is quite obtainable to run a highly available infrastructure on spot instances to cash in on these savings, if you’re interested check out: Highly Available Spot Architecture.

Here’s a chart at the 14GB 8CPU level:

If you want 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 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.

One-off Tasks

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.

Standard Heroku ECS Fargate 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 run command 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 task command 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 😁

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 LinkedIn.

Got questions? Check out BoltOps.

Originally published at blog.boltops.com on April 22, 2018.

--

--