Deploy ecs with ec2 spot

I need to deploy ecs with ec2 spot, I understand that from the launch template I can have options to specify in the “instance_market_options” but is it mandatory to also have a capacity provider? If so, how can it be specified? Since in the documentation I only see the option for fargate and fargate spot.

What other recommendations should I take into account to deploy ecs with ec2 spot?

thank u

AWS Rag answer

Using EC2 Spot Instances with ECS does not require a capacity provider, but it’s highly recommended for better scalability and management. To use Spot Instances, specify instance_market_options in your launch template. For capacity providers, create one linked to an Auto Scaling group that uses your Spot Instance launch template, then associate it with your ECS cluster. Key recommendations include diversifying instance types, handling Spot interruptions gracefully, utilizing ECS managed scaling, setting up monitoring and alerts, and managing costs effectively.

1 Like