Skip to content

Commit 563887f

Browse files
committed
feat: Use ECS task protection instead of EC2 instance protection for auto-scaling
This will let tasks complete and not be force-terminated by ECS fixes #23
1 parent c6c80cc commit 563887f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/processing/autoscaling.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ resource "aws_ecs_capacity_provider" "worker_lt_gpu_provider" {
101101

102102
auto_scaling_group_provider {
103103
auto_scaling_group_arn = aws_autoscaling_group.worker_lt_asg.arn
104-
managed_termination_protection = "DISABLED"
104+
managed_termination_protection = "ENABLED"
105105

106106
managed_scaling {
107107
status = "ENABLED"

modules/processing/ecs_task_roles.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ resource "aws_iam_role" "processing_worker_role" {
6464

6565
resource "aws_iam_policy" "processing_worker_policy" {
6666
name = "processing-worker-task-policy${var.env}"
67-
description = "Policy for ECS tasks to manage instance protection during Auto Scaling scale-in events and get CloudWatch metrics"
67+
description = "Policy for ECS tasks to manage ecs task protection during Auto Scaling scale-in events and get CloudWatch metrics"
6868

6969
policy = jsonencode({
7070
Version = "2012-10-17"
7171
Statement = [
7272
{
7373
Effect = "Allow"
7474
Action = [
75-
"autoscaling:SetInstanceProtection",
76-
"autoscaling:DescribeAutoScalingInstances"
75+
"ecs:GetTaskProtection",
76+
"ecs:UpdateTaskProtection"
7777
]
7878
Resource = "*"
7979
},

0 commit comments

Comments
 (0)