I'm looking at running a small containerized web workload on ECS. What setup keeps costs down without creating a lot of extra work, and what charges are easy to overlook?
What's a cost-effective way to run a small ECS workload?
Answers
For a small workload, compare ECS on a properly sized EC2 instance with Fargate. A single instance can be economical, especially if you can run several containers on it, but you own the host patching and maintenance.
Fargate costs more for the managed compute, but avoids that server work. Fargate Spot is another option if the workload can tolerate interruptions. There isn't a magic node count where one choice always wins, so price the actual capacity and availability you need.
Reply to this answer
Check the fixed networking costs before optimizing the containers. A load balancer can be a noticeable part of the bill for a tiny service. If there's already a production load balancer, host-based routing may let other environments share it.
Also look at outbound access. Public IPv4 addresses have a cost, while private subnets may need a NAT gateway or NAT instance for outbound connections. Which is cheaper depends on the setup and traffic.
Reply to this answer
If the service gets occasional requests rather than needing containers running all the time, compare it with Lambda. An event-driven function may be cheaper at low volume, though the result depends on request volume, execution time and memory.
Don't assume every web-oriented function setup costs nothing while idle. Check its current compute, memory and scale-down billing rules against the event-driven option.
Reply to this answer
One leaner container setup is ECS on a single EC2 Spot instance, with HAProxy routing to the app through Cloud Map service discovery instead of an application load balancer or API Gateway. That can cut infrastructure costs, but it adds proxy and discovery configuration to maintain and leaves you exposed to the single instance going away.
That trade may be fine for a noncritical environment. For production, weigh the savings against the availability and operational work you actually need.
Reply to this answer
Add your answer
Answers are reviewed before publication.
u.572+canvasrivet:
Spot on EC2 can also reduce compute costs, but a single Spot instance means an interruption can take the whole service offline.