Free tool

EC2 instance finder for ECS

Describe your services and see which EC2 instance types run them for the least, how many instances you need and how full they get.

Services and constraints 3 services · US East (N. Virginia) · us-east-1 · awsvpc

Constraints

Deployment headroom Spare room for rolling deployments, in percent of each service's tasks. 100% fits a full second set.
Minimum instances Per fleet, so one failing instance doesn't take your services down.
Networking mode
Each task takes a network interface, which limits tasks per instance.
Processor
ARM services run on Graviton, x86 ones on Intel or AMD.

Your services

  • web 6 × 0.5 vCPU, 1 GB
  • api 4 × 1 vCPU, 3 GB
  • worker 3 × 2 vCPU, 4 GB · Spot

Loading prices to edit them…

Linux · x86 · On-Demand

  • web
  • api
Instance type
$314570% / 45% $133 unused
$315570% / 45% $134 unused
$350570% / 45% $149 unused
$350570% / 45% $149 unused
$350570% / 45% $149 unused
$367570% / 45% $156 unused
$368570% / 45% $156 unused
$376570% / 45% $160 unused
$386570% / 45% $164 unused
$391750% / 64% $168 unused

Your cluster

5 × m5a.large On-Demand + 3 × m6i.large Spot · $396 per month

Pick another type in the table to try it here.

m5a.large On-Demand
CPU 100% Memory 75%
apiapi
2 tasks · 2 vCPU, 8 GB
m5a.large On-Demand
CPU 100% Memory 75%
apiapi
2 tasks · 2 vCPU, 8 GB
m5a.large On-Demand
CPU 50% Memory 25%
webweb
2 tasks · 2 vCPU, 8 GB
m5a.large On-Demand
CPU 50% Memory 25%
webweb
2 tasks · 2 vCPU, 8 GB
m5a.large On-Demand
CPU 50% Memory 25%
webweb
2 tasks · 2 vCPU, 8 GB
m6i.large Spot
CPU 100% Memory 50%
worker
1 task · 2 vCPU, 8 GB
m6i.large Spot
CPU 100% Memory 50%
worker
1 task · 2 vCPU, 8 GB
m6i.large Spot
CPU 100% Memory 50%
worker
1 task · 2 vCPU, 8 GB
unreserved

Questions

Which EC2 instance type should I use for ECS?

The one your tasks fill best. If your tasks need about 4 GB of memory per vCPU, general purpose types (m7g, m7i, m7a) fit them with little waste; with 2 GB per vCPU, compute optimized types (c7g, c7i) are cheaper; with 8 GB or more, memory optimized ones (r7g, r7i). The finder packs your actual tasks onto every current type and ranks them by what the whole fleet costs.

How many ECS tasks fit on an EC2 instance?

As many as its CPU and memory allow, after about 10% of memory for the operating system and the ECS agent, and in awsvpc mode no more than its network interfaces allow. An m7g.xlarge (4 vCPU, 16 GB) holds three 1 vCPU, 2 GB tasks in awsvpc mode, but four in bridge mode.

Why can my instance only run 2 tasks in awsvpc mode?

In awsvpc mode every task gets its own elastic network interface (ENI), and the instance keeps one for itself. A large instance such as m7g.large has 3 ENIs, so it runs at most 2 awsvpc tasks, however small they are. Bridge or host mode has no such limit. ENI trunking raises the limit on supported Nitro types; the finder doesn't model trunking yet, so with it turned on you can fit more tasks than shown.

Graviton or Intel for ECS?

Graviton (ARM) instances cost about 20% less than Intel ones of the same size, for example $0.0816 an hour for m7g.large against $0.1008 for m7i.large in us-east-1. They need images built for arm64; multi-arch images run on both. Windows tasks run on x86 only.

Should I use many small or few large instances?

Fewer, larger instances waste less capacity on the per-instance overhead and leftover space, and need fewer ENIs per task. More, smaller instances lose less when one fails and scale in finer steps. Set a minimum number of instances and spread them across availability zones, then let the finder pick the cheapest type that meets both.

How much spare capacity do ECS deployments need?

A rolling deployment starts new tasks before it stops old ones. With the default maximum healthy percent of 200%, ECS can start a full second set, so the cluster needs room for it, or capacity provider scaling has to add instances first. A deployment headroom of 50 to 100% of the largest service's tasks covers most setups.

Does it use Spot prices?

Yes. For services that can run on Spot, the finder uses the savings and interruption rates from the AWS Spot Instance Advisor for each type in your region. Types the advisor doesn't list get a 70% savings estimate.

Not sure EC2 is the right choice? Read Fargate vs EC2 for Amazon ECS or compare both in the ECS cost calculator.