From b225d49e6c57e108499a49b6b3cc4f11b58af3ad Mon Sep 17 00:00:00 2001 From: jamin Date: Sun, 17 May 2026 17:21:54 -0700 Subject: [PATCH] chore: holding pattern cost reduction - Add "under active development" banner to base template linking to GitHub repo - Disable user registration via SSM (FILEPROXY_REGISTRATION_ENABLED=False) - Shrink all ECS task definitions to Fargate minimum (0.25 vCPU / 512 MB) - Reduce Gunicorn and Celery worker counts to 1 to match smaller CPU allocation - Cap autoscaling max to 1 for api/ui/worker (prevent scale-out) Reduces estimated monthly cost from ~$168 to ~$74/mo (~56% reduction). Requires `terraform apply` to take effect. Co-Authored-By: Claude Sonnet 4.6 --- fileproxy/templates/base.html | 5 +++++ terraform/ecs.tf | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/fileproxy/templates/base.html b/fileproxy/templates/base.html index 5c881c6..83e1c6a 100644 --- a/fileproxy/templates/base.html +++ b/fileproxy/templates/base.html @@ -101,6 +101,11 @@ + +
+ Under active development — view on GitHub +
+
{% if messages %} diff --git a/terraform/ecs.tf b/terraform/ecs.tf index f0a858b..ef66d0f 100644 --- a/terraform/ecs.tf +++ b/terraform/ecs.tf @@ -94,8 +94,8 @@ resource "aws_ecs_task_definition" "api" { family = "${var.project}-${var.env}-api" network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] - cpu = "1024" - memory = "2048" + cpu = "256" + memory = "512" execution_role_arn = aws_iam_role.ecs_execution.arn task_role_arn = aws_iam_role.ecs_task.arn @@ -123,7 +123,7 @@ resource "aws_ecs_task_definition" "api" { environment = concat(local.common_env, [ { name = "DJANGO_MODE", value = "api" }, - { name = "GUNICORN_WORKERS", value = "4" }, + { name = "GUNICORN_WORKERS", value = "1" }, { name = "GUNICORN_TIMEOUT", value = tostring(local.api_timeout_s) }, ]) @@ -141,8 +141,8 @@ resource "aws_ecs_task_definition" "ui" { family = "${var.project}-${var.env}-ui" network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] - cpu = "512" - memory = "1024" + cpu = "256" + memory = "512" execution_role_arn = aws_iam_role.ecs_execution.arn task_role_arn = aws_iam_role.ecs_task.arn @@ -155,7 +155,7 @@ resource "aws_ecs_task_definition" "ui" { environment = concat(local.common_env, [ { name = "DJANGO_MODE", value = "ui" }, - { name = "GUNICORN_WORKERS", value = "2" }, + { name = "GUNICORN_WORKERS", value = "1" }, { name = "GUNICORN_TIMEOUT", value = "60" }, ]) @@ -171,8 +171,8 @@ resource "aws_ecs_task_definition" "worker" { family = "${var.project}-${var.env}-worker" network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] - cpu = "1024" - memory = "2048" + cpu = "256" + memory = "512" execution_role_arn = aws_iam_role.ecs_execution.arn task_role_arn = aws_iam_role.ecs_task.arn @@ -198,7 +198,7 @@ resource "aws_ecs_task_definition" "worker" { environment = concat(local.common_env, [ { name = "DJANGO_MODE", value = "worker" }, - { name = "CELERY_WORKERS", value = "4" }, + { name = "CELERY_WORKERS", value = "1" }, ]) secrets = local.common_secrets @@ -395,9 +395,9 @@ resource "aws_ecs_service" "beat" { locals { autoscaling = { - api = { service = aws_ecs_service.api.name, max = 10, min = 1, target_cpu = 60.0, scale_in = 120 } - ui = { service = aws_ecs_service.ui.name, max = 3, min = 1, target_cpu = 70.0, scale_in = 180 } - worker = { service = aws_ecs_service.worker.name, max = 5, min = 1, target_cpu = 60.0, scale_in = 120 } + api = { service = aws_ecs_service.api.name, max = 1, min = 1, target_cpu = 60.0, scale_in = 120 } + ui = { service = aws_ecs_service.ui.name, max = 1, min = 1, target_cpu = 70.0, scale_in = 180 } + worker = { service = aws_ecs_service.worker.name, max = 1, min = 1, target_cpu = 60.0, scale_in = 120 } } }