Optimize default resource sizing for cost efficiency

- RDS: reduce replicas 2→1, monitoring_interval 10s→60s
- Redis: cluster_size 3→2, instance_type cache.m5.large→cache.t4g.small
- ECS: Fargate 50/50 FARGATE/SPOT split, disable Container Insights
- ECS log retention: 90→30 days
- Add dev.tfvars.example for aggressive dev/staging savings
This commit is contained in:
Leon Xu committed 2026-07-14 20:00:18 -07:00
1 parent c09d3aa68c
commit bd235f0ee6
4 files changed
+112 -34

No files matched your search

+14
View File
@@ -1,3 +1,17 @@
# Cost optimization defaults (production-sensible):
# - RDS: 1 replica (HA), db.t4g.large, monitoring_interval=60s
# - Redis: 2 nodes (HA), cache.t4g.small
# - Fargate: 50% FARGATE / 50% FARGATE_SPOT
# - Container Insights: disabled
# - ECS log retention: 30 days
# - VPC flow logs: disabled
#
# For dev/staging, override with aggressive savings:
# rds_config = { replicas = 0, monitoring_interval = 0, performance_insights_enabled = false }
# redis_config = { cluster_size = 1 }
# ecs_cluster = { fargate_capacity_providers = { FARGATE_SPOT = { default_capacity_provider_strategy = { weight = 100 } } } }
# vpc = { enable_nat_gateway = false }
locals {
vpc_flow_log_cloudwatch_log_group_cmk_enabled = var.vpc.flow_log_cloudwatch_log_group_kms.cmk_enabled
vpc_flow_log_cloudwatch_log_group_create_kms_key = var.vpc.enable_flow_log == true && var.vpc.create_flow_log_cloudwatch_log_group == true && local.vpc_flow_log_cloudwatch_log_group_cmk_enabled == true && var.vpc.flow_log_cloudwatch_log_group_kms.kms_key_arn == null