I'm using ApplicationLoadBalancedFargateService in my AWS-CDK project (using Java).
I would like to configure the service to spin up only FARGATE_SPOT instances, but I haven't find any way to do it. Is there any way to do it?
I think I found the solution:
Cluster cluster = new Cluster(...);
cluster.enableFargateCapacityProviders();
ApplicationLoadBalancedFargateService fargateService = new ApplicationLoadBalancedFargateService(
this,
"FargateService",
ApplicationLoadBalancedFargateServiceProps.builder()
.cluster(cluster)
.capacityProviderStrategies(
singletonList(CapacityProviderStrategy.builder()
.capacityProvider("FARGATE_SPOT")
.weight(1)
.build()
))
....
.build());