CodePark/ questions / Compute: EC2, ECS, Fargate & EKS
START PRACTICINGPRACTICE
Backend question · Cloud & AWS › Compute: EC2, ECS, Fargate & EKS

Which workload is the best fit for EC2 Spot Instances?

A nightly batch job that resizes images from a queue and can retry any item that gets interrupted

The best fit is "A nightly batch job that resizes images from a queue and can retry any item that gets interrupted".

Spot Instances use spare EC2 capacity at a large discount. But AWS can take an instance back at any time, with only a two-minute warning. So Spot suits work that is stateless (keeps no important data on the machine) and fault-tolerant (can survive a stopped machine). A queue-driven batch job is a good example: if a machine stops, the item goes back to the queue and another machine retries it.


The other options suffer badly from an interruption:

• "The single primary database for your production app" would go down and could lose data.

• "A stateful WebSocket server that must keep each connection for hours" would drop all its connections.

• "A licence server that must have the same instance running for a year" needs one machine that never stops.