Quick post today about cost saving on AWS. As you know, two of my preferred subjects on Public Cloud are Security and FinOps!

Recently, AWS introduced a way to reduce AWS bills by up to 70% using Spot instances with the AWS Fargate service.

It’s really easy to use. If your workload is interruption-proof, batch jobs, or CI/CD containers, don’t hesitate to use it to drastically reduce your workload costs.

Using Terraform, you just have to specify capacity_providers and/or default_capacity_provider_strategy on your aws_ecs_cluster resource.

1
2
3
4
5
6
7
8
9
resource "aws_ecs_cluster" "ecs_cluster" {
  name               = "${var.project}_ecs_cluster_${var.env}"
  capacity_providers = ["FARGATE_SPOT"]

  default_capacity_provider_strategy {
    capacity_provider = "FARGATE_SPOT"
    weight            = "100"
  }
}

These settings don’t seem to be available yet on CloudFormation.

That’s all folks!

zoph.