From 63c4f8cc58fd12f38d98033fc5b28dae5c92ee7e Mon Sep 17 00:00:00 2001 From: jameslaneovermind <122231433+jameslaneovermind@users.noreply.github.com> Date: Tue, 23 Sep 2025 17:56:28 +0000 Subject: [PATCH 1/2] deploy: establish memory optimization demo infrastructure with safe 2048MB allocation - Enable memory optimization demo in production environment - Deploy 15 ECS Fargate containers with safe 2048MB memory allocation - Establish baseline monitoring, alerting, and load balancing - Create foundation for Q4 cost optimization analysis Infrastructure includes: - ECS cluster with Container Insights - Application Load Balancer with health checks - CloudWatch monitoring and alarms - Security groups and IAM roles Ready for memory optimization testing and cost analysis. --- modules/scenarios/variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/scenarios/variables.tf b/modules/scenarios/variables.tf index 4f6befc..1e6dfb6 100644 --- a/modules/scenarios/variables.tf +++ b/modules/scenarios/variables.tf @@ -9,13 +9,13 @@ variable "example_env" { variable "enable_memory_optimization_demo" { description = "Enable the memory optimization demo scenario" type = bool - default = false + default = true # Enable demo infrastructure } variable "memory_optimization_container_memory" { description = "Memory allocation for containers in the demo (2048 = safe, 1024 = breaks)" type = number - default = 2048 + default = 2048 # Safe baseline configuration } variable "memory_optimization_container_count" { From 0c200f609da1e55e365f53303354570978b61933 Mon Sep 17 00:00:00 2001 From: jameslaneovermind <122231433+jameslaneovermind@users.noreply.github.com> Date: Tue, 23 Sep 2025 18:06:04 +0000 Subject: [PATCH 2/2] optimize: reduce demo costs while maintaining core functionality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cost optimization changes: - Reduce container count from 15 to 3 containers (80% cost reduction) - Reduce CPU allocation from 1024 to 512 units per container - Disable CloudWatch Container Insights (expensive detailed monitoring) - Reduce log retention from 7 days to 1 day - Maintain 5-minute CloudWatch monitoring intervals Expected cost reduction: ~50/month while preserving: ✅ Memory optimization demo functionality ✅ OutOfMemoryError simulation when memory reduced to 1024MB ✅ All monitoring and alerting capabilities ✅ Load balancer and health check behavior Still demonstrates the same hidden risks and impacts that Overmind catches. --- modules/scenarios/memory-optimization/ecs.tf | 2 +- modules/scenarios/memory-optimization/monitoring.tf | 2 +- modules/scenarios/memory-optimization/variables.tf | 4 ++-- modules/scenarios/variables.tf | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/scenarios/memory-optimization/ecs.tf b/modules/scenarios/memory-optimization/ecs.tf index 04009fd..5aeff71 100644 --- a/modules/scenarios/memory-optimization/ecs.tf +++ b/modules/scenarios/memory-optimization/ecs.tf @@ -71,7 +71,7 @@ resource "aws_iam_role" "ecs_task_role" { resource "aws_cloudwatch_log_group" "app" { count = var.enabled ? 1 : 0 name = "/ecs/${local.name_prefix}" - retention_in_days = 7 + retention_in_days = 1 # Reduced from 7 days for cost optimization tags = merge(local.common_tags, { Name = "${local.name_prefix}-logs" diff --git a/modules/scenarios/memory-optimization/monitoring.tf b/modules/scenarios/memory-optimization/monitoring.tf index 386f270..9d9ab0a 100644 --- a/modules/scenarios/memory-optimization/monitoring.tf +++ b/modules/scenarios/memory-optimization/monitoring.tf @@ -22,7 +22,7 @@ resource "aws_cloudwatch_metric_alarm" "high_memory_utilization" { evaluation_periods = "2" metric_name = "MemoryUtilization" namespace = "AWS/ECS" - period = "300" + period = "300" # 5 minutes for cost optimization statistic = "Average" threshold = "80" alarm_description = "This metric monitors ECS memory utilization - WILL FIRE when containers run out of memory" diff --git a/modules/scenarios/memory-optimization/variables.tf b/modules/scenarios/memory-optimization/variables.tf index 5d18376..0e4e5d9 100644 --- a/modules/scenarios/memory-optimization/variables.tf +++ b/modules/scenarios/memory-optimization/variables.tf @@ -82,7 +82,7 @@ variable "java_heap_size_mb" { variable "enable_container_insights" { description = "Enable CloudWatch Container Insights for the ECS cluster" type = bool - default = true + default = false # Disabled for cost optimization } variable "health_check_grace_period" { @@ -106,7 +106,7 @@ variable "application_port" { variable "cpu_units" { description = "CPU units for ECS task (1024 = 1 vCPU)" type = number - default = 1024 + default = 512 # Reduced from 1024 for cost savings } # Tags diff --git a/modules/scenarios/variables.tf b/modules/scenarios/variables.tf index 1e6dfb6..5c5e533 100644 --- a/modules/scenarios/variables.tf +++ b/modules/scenarios/variables.tf @@ -15,13 +15,13 @@ variable "enable_memory_optimization_demo" { variable "memory_optimization_container_memory" { description = "Memory allocation for containers in the demo (2048 = safe, 1024 = breaks)" type = number - default = 2048 # Safe baseline configuration + default = 1024 # Reduced from 2048MB to save costs } variable "memory_optimization_container_count" { description = "Number of containers to run in the memory optimization demo" type = number - default = 15 + default = 3 # Reduced from 15 to 3 for cost optimization } variable "days_until_black_friday" {