Skip to content
22K
Console
Blog

Container Spot capacity

JayJanuary 13, 2025

We are adding support for using Spot instances when you create a Fargate service with the Cluster component through the capacity prop. Spot instances can be around 50% cheaper and we talk about how they work here.

Play

Background

You can create container services with ECS and Fargate in SST with the Cluster component.

You are charged per hour of vCPU and GB of memory used. With our base config, this works out to around $12 per month.

Spot instances are spare capacity that AWS has and it’s available at a discounted rate, around $6 per month.


Spot

You can enable this using the new capacity prop.

sst.config.ts
new sst.aws.Cluster("MyCluster", { vpc });
cluster.addService("MyService", {
loadBalancer: {
ports: [{ listen: "80/http" }],
},
capacity: "spot"
});

You can also configure the % of regular Fargate vs Spot capacity you want to use.

sst.config.ts
capacity: {
fargate: { weight: 1 },
spot: { weight: 1 }
}

Learn more about the capacity prop.


Caveats

There are a couple of caveats.

  1. AWS may reclaim this capacity and turn off your service after a two-minute warning. This is rare, but it can happen.
  2. If there’s no spare capacity, you’ll get an error.

This makes Fargate Spot a good option for dev or PR environments.

sst.config.ts
capacity: $app.stage === "production" ? undefined : "spot"

Get started

Get started by checking out the Fargate Spot capacity example.

You can also check out our container service quick starts.

These will help you get started with building container services.