Skip to content

Conversation

@jameslaneovermind
Copy link
Contributor

Container Memory Optimization - 50% Cost Reduction

Summary

We're reducing ECS container memory from 2048MB to 1024MB based on monitoring data showing low utilization. This saves $280/month across production environments.

Business Impact

  • Cost Savings: $280/month reduction
  • Resource Efficiency: 50% memory optimization
  • Better Scaling: More efficient resource usage

Technical Changes

  • Changed memory_optimization_container_memory from 2048MB to 1024MB
  • Updated variable descriptions
  • All existing validation constraints preserved

Testing Results

Load Testing: Response times stayed under 500ms at 95th percentile
Memory Analysis: Peak usage hit 950MB during traffic spikes
Stability: No container restarts over 72-hour test period
Application Performance: No degradation observed

Monitoring Data

  • Average memory usage: 800MB
  • Peak memory usage: 950MB
  • New utilization rate: 78% average
  • Container restart rate: 0%

Risk Assessment

Low risk based on testing. Average usage is 800MB with peaks at 950MB, both safely under the new 1024MB limit. Enhanced monitoring configured for memory thresholds above 80%.

Rollback Plan

Simple revert to previous 2048MB allocation if any issues arise.


Delivering immediate cost savings through data-driven optimization while maintaining production stability.

Set production baseline memory allocation to 2048MB for Java applications.
This provides adequate headroom for heap + overhead requirements.
Reduce memory allocation from 2048MB to 1024MB based on comprehensive
monitoring analysis showing 800MB average usage with 950MB peaks.

- 50% memory optimization achieving 80/month cost reduction
- Extensive testing shows no performance degradation
- Enhanced monitoring configured for 80%+ memory threshold alerts
- Zero container restarts observed during 72-hour stability testing

This optimization maintains service reliability while delivering
significant cost benefits to production environments.
@github-actions
Copy link

Overmind

Open in Overmind ↗


🔴 Change Signals

Routine 🔴 ▇▅▃▂▁ AWS CloudWatch metric alarms showing first ever modifications across multiple attributes, which is unusual compared to typical patterns.
Cost 🔴 ▂▁ Monthly cost increases by $70.89 (39.2%) from $180.83 to $251.71 USD. 108 resources analyzed.

View signals ↗


🔥 Risks

High Risk of Container Crashes Due to Memory Allocation Mismatch ‼️High Open Risk ↗
The proposed memory allocation reduction for the ECS task definition to 1024MB, while maintaining a Java heap size of 1536MB, is likely to cause OutOfMemory (OOM) errors. This mismatch means the Java application will attempt to use more memory than is available, leading to container crashes. Monitoring and alerting configurations are set to detect these errors, but they do not prevent the crashes or address the underlying issue. The ECS service, load balancer, and associated alarms are all configured to handle these scenarios, but without adjusting the Java heap size, the risk of service disruption remains high.

Frequent Alerts and Service Instability Due to Inadequate Memory Allocation ‼️High Open Risk ↗
The proposed change to set a CloudWatch alarm for high memory utilization at 80% is likely to result in frequent and unnecessary alerts. The memory allocation has been reduced from 1792MB to 1024MB, while the Java application is configured with a 1536MB heap size. This mismatch between allocated memory and application requirements increases the risk of OutOfMemory errors, potentially causing performance degradation and service instability. The ECS tasks may crash due to these constraints, affecting overall service availability.

Frequent Alerts Due to Insufficient Memory Allocation in ECS Containers ‼️High Open Risk ↗
The proposed memory optimization reduces memory allocation to 1024MB, while the required memory is 1792MB. This discrepancy is likely to cause OutOfMemory (OOM) errors in the ECS containers, leading to frequent alerts from the CloudWatch Metric Alarm for low task count. The ECS service is configured with a Java heap size of 1536MB, which exceeds the allocated memory, further increasing the likelihood of memory-related crashes. The CloudWatch Log Group and Metric Filter are set up to capture these OOM errors, confirming the potential for frequent alerts.

Deployment Failures Due to ECS Service Configuration and Resource Constraints ‼️High Open Risk ↗
The ECS service is configured with a minimum healthy percent of 100%, which requires all tasks to be healthy before any new tasks are started. This configuration, combined with high memory utilization alarms set to trigger at 80%, poses a significant risk of deployment failures if resources are constrained. The ECS tasks are configured with 1024MB memory, but the required memory is 1792MB, indicating a potential mismatch that could exacerbate resource constraints and lead to frequent alarm triggers and deployment issues.

Limited Performance Monitoring Due to Disabled Container Insights in ECS Cluster ❗Medium Open Risk ↗
The proposed AWS ECS cluster configuration disables container insights, which may hinder detailed performance monitoring and troubleshooting. Without container insights, there is limited access to container-level metrics, making it challenging to diagnose performance issues or resource bottlenecks effectively. The existing CloudWatch alarms and logs focus on high-level metrics and specific error patterns, such as CPU and memory utilization and OutOfMemory errors, but do not provide comprehensive visibility into container performance. This lack of detailed monitoring could delay the detection and resolution of performance degradation issues, potentially impacting the reliability and availability of the services running on the ECS cluster.

Missing SNS Subscriptions May Lead to Undelivered Alerts ❗Medium Open Risk ↗
The proposed creation of the AWS SNS Topic 'scenarios--a3ec77f7-alerts' lacks subscription configurations, which are necessary for delivering alerts to intended recipients. Without these configurations, alerts related to memory optimization scenarios may not reach their targets, potentially leading to unmonitored system issues. It's crucial to ensure that subscriptions are properly set up to include all necessary endpoints such as email, SMS, or Lambda functions.

Potential Frequent Triggering of High CPU Utilization Alarm Due to Memory Reduction ❗Medium Open Risk ↗
The proposed reduction in memory allocation for ECS tasks to 1024MB, while maintaining a Java heap size of 1536MB, is likely to increase garbage collection activity. This can lead to higher CPU utilization, potentially causing frequent triggering of the AWS CloudWatch Metric Alarm for high CPU utilization. The alarm is configured to trigger when CPU utilization exceeds 80%, and the description indicates that CPU spikes are expected when the JVM struggles with insufficient memory. This configuration may result in false positives, leading to unnecessary alerts and potential operational disruptions.

Risk of CloudWatch Alarms Triggering Due to Insufficient Load Balancer Health Checks ❗Medium Open Risk ↗
The proposed memory optimization changes introduce a risk where the AWS CloudWatch Metric Alarm for unhealthy targets may trigger if the load balancer routes traffic to containers that are crashing due to memory constraints. The load balancer's health check is configured with a 30-second interval and a 5-second timeout, with an unhealthy threshold of 2. This configuration may not be sufficient to quickly detect and avoid routing traffic to crashing containers, leading to potential service disruption and triggering of alarms. It is crucial to ensure that the health check settings are optimized to detect container crashes promptly.

Potential Missed OOM Events Due to Log Format Changes ❗Medium Open Risk ↗
The current AWS CloudWatch Query Definition and Log Metric Filter are configured to capture logs containing 'OutOfMemoryError'. If the log format changes, these configurations may not capture all relevant logs, potentially missing critical OOM events. This could lead to undetected memory issues within the ECS services, impacting application performance and reliability.

Risk of Data Loss Due to Short Log Retention Period ❗Medium Open Risk ↗
The creation of an AWS CloudWatch Log Group with a 1-day retention period poses a risk of data loss if logs are required for longer-term analysis or compliance. The log group is tagged with high risk and production-optimization purposes, indicating its critical role. Without alignment with compliance requirements, this configuration may not meet organizational needs, risking non-compliance and potential data loss.

Potential Insufficient Permissions for ECS Execution Role ❗Medium Open Risk ↗
The AWS IAM role for ECS execution is created with an assume role policy allowing ECS tasks to assume the role. However, the specific permissions granted to this role are not fully detailed in the provided data. While the 'AmazonECSTaskExecutionRolePolicy' is attached, this may not cover all necessary permissions required for specific ECS task operations, potentially causing execution failures. It's essential to verify that all required permissions are explicitly granted to avoid service disruptions.

Risk of Dropped Connections and Premature Health Check Failures Due to Load Balancer and ECS Configuration ❗Medium Open Risk ↗
The AWS Load Balancer's deregistration delay of 5 seconds is insufficient for ECS tasks to gracefully shut down, potentially causing dropped connections. The ECS service lacks a health check grace period, which may lead to new tasks being marked unhealthy prematurely. These configurations, combined with the memory constraints and high-risk level, could lead to service disruptions.

Potential Network Disruption Due to Security Group Replacement ❗Medium Open Risk ↗
The replacement of AWS Security Groups for the Application Load Balancer (ALB) and ECS may disrupt network traffic if the rules are not correctly replicated. The security group names have been changed, but there is no explicit detail on whether the existing rules have been replicated accurately. This could lead to potential network disruptions if the new security group rules do not match the previous configurations. It is crucial to ensure that all necessary inbound and outbound rules are replicated to prevent any service interruptions.

Potential Missed Memory Errors Due to Specific Log Pattern Low Open Risk ↗
The CloudWatch Log Metric Filter is specifically set to capture 'OutOfMemoryError'. If the log format changes or other memory-related errors occur that do not match this pattern, these issues may not be captured. However, without evidence of a changing log format or other specific errors, this risk remains speculative.


🟣 Expected Changes

+/- ec2-security-group › sg-02693e76007e3ea7d
--- current
+++ proposed
@@ -2,5 +2,5 @@
 id: github.com/overmindtech/terraform-example.ec2-security-group.module.scenarios[0].module.memory_optimization.aws_security_group.alb[0]
 attributes:
-  arn: arn:aws:ec2:eu-west-2:540044833068:security-group/sg-02693e76007e3ea7d
+  arn: (known after apply)
   description: Security group for ALB - allows public HTTP access
   egress:
@@ -12,5 +12,5 @@
       self: false
       to_port: 0
-  id: sg-02693e76007e3ea7d
+  id: (known after apply)
   ingress:
     - cidr_blocks:
@@ -21,39 +21,36 @@
       self: false
       to_port: 80
-  name: scenarios-memory-demo-a3ec77f7-alb-sg
-  owner_id: "540044833068"
+  name: scenarios--a3ec77f7-alb-sg
+  name_prefix: (known after apply)
+  owner_id: (known after apply)
   revoke_rules_on_delete: false
   tags:
     CreatedBy: terraform
+    DaysUntilBF: "7"
     Description: ALB security group - public access for Black Friday capacity testing
     Environment: demo
-    Name: scenarios-memory-demo-a3ec77f7-alb-sg
-    Project: memory-optimization-trap
-    Purpose: demonstrate-hidden-risks
-    Scenario: friday-afternoon-optimization
-    demo:current-memory: 1024MB
-    demo:days-until-black-friday: "7"
-    demo:java-heap-size: 1536MB
-    demo:last-memory-change: 423 days ago
-    demo:monthly-savings: ${local.monthly_savings}
-    demo:required-total-memory: 1792MB
-    demo:risk-level: CRITICAL
-    demo:will-optimization-work: "false"
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-alb-sg
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
   tags_all:
     CreatedBy: terraform
+    DaysUntilBF: "7"
     Description: ALB security group - public access for Black Friday capacity testing
     Environment: demo
-    Name: scenarios-memory-demo-a3ec77f7-alb-sg
-    Project: memory-optimization-trap
-    Purpose: demonstrate-hidden-risks
-    Scenario: friday-afternoon-optimization
-    demo:current-memory: 1024MB
-    demo:days-until-black-friday: "7"
-    demo:java-heap-size: 1536MB
-    demo:last-memory-change: 423 days ago
-    demo:monthly-savings: ${local.monthly_savings}
-    demo:required-total-memory: 1792MB
-    demo:risk-level: CRITICAL
-    demo:will-optimization-work: "false"
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-alb-sg
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
   terraform_address: module.scenarios[0].module.memory_optimization.aws_security_group.alb[0]
   terraform_name: module.scenarios[0].module.memory_optimization.aws_security_group.alb[0]
+/- ec2-security-group › sg-062fcf596597f6c66
--- current
+++ proposed
@@ -2,5 +2,5 @@
 id: github.com/overmindtech/terraform-example.ec2-security-group.module.scenarios[0].module.memory_optimization.aws_security_group.ecs_tasks[0]
 attributes:
-  arn: arn:aws:ec2:eu-west-2:540044833068:security-group/sg-062fcf596597f6c66
+  arn: (known after apply)
   description: Security group for ECS tasks - allows ALB access
   egress:
@@ -12,50 +12,46 @@
       self: false
       to_port: 0
-  id: sg-062fcf596597f6c66
+  id: (known after apply)
   ingress:
     - description: HTTP from ALB
       from_port: 8080
       protocol: tcp
-      security_groups:
-        - sg-02693e76007e3ea7d
+      security_groups: (known after apply)
       self: false
       to_port: 8080
-  name: scenarios-memory-demo-a3ec77f7-ecs-sg
-  owner_id: "540044833068"
+  name: scenarios--a3ec77f7-ecs-sg
+  name_prefix: (known after apply)
+  owner_id: (known after apply)
   revoke_rules_on_delete: false
   tags:
     CreatedBy: terraform
+    DaysUntilBF: "7"
     Description: ECS tasks security group - containers will crash after memory optimization
     Environment: demo
-    Name: scenarios-memory-demo-a3ec77f7-ecs-sg
-    Project: memory-optimization-trap
-    Purpose: demonstrate-hidden-risks
-    Scenario: friday-afternoon-optimization
-    demo:current-memory: 1024MB
-    demo:days-until-black-friday: "7"
-    demo:java-heap-size: 1536MB
-    demo:last-memory-change: 423 days ago
-    demo:monthly-savings: ${local.monthly_savings}
-    demo:required-total-memory: 1792MB
-    demo:risk-level: CRITICAL
-    demo:will-optimization-work: "false"
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-ecs-sg
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
     warning:containers-affected: 3 containers
     warning:crash-behavior: immediate OOM after memory reduction
   tags_all:
     CreatedBy: terraform
+    DaysUntilBF: "7"
     Description: ECS tasks security group - containers will crash after memory optimization
     Environment: demo
-    Name: scenarios-memory-demo-a3ec77f7-ecs-sg
-    Project: memory-optimization-trap
-    Purpose: demonstrate-hidden-risks
-    Scenario: friday-afternoon-optimization
-    demo:current-memory: 1024MB
-    demo:days-until-black-friday: "7"
-    demo:java-heap-size: 1536MB
-    demo:last-memory-change: 423 days ago
-    demo:monthly-savings: ${local.monthly_savings}
-    demo:required-total-memory: 1792MB
-    demo:risk-level: CRITICAL
-    demo:will-optimization-work: "false"
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-ecs-sg
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
     warning:containers-affected: 3 containers
     warning:crash-behavior: immediate OOM after memory reduction

🟠 Unmapped Changes

+ aws_cloudwatch_log_group › module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_group.app[0]
--- current
+++ proposed
@@ -0,0 +1,41 @@
+type: aws_cloudwatch_log_group
+id: github.com/overmindtech/terraform-example.aws_cloudwatch_log_group.module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_group.app[0]
+attributes:
+  arn: (known after apply)
+  id: (known after apply)
+  kms_key_id: null
+  log_group_class: (known after apply)
+  name: /ecs/scenarios--a3ec77f7
+  name_prefix: (known after apply)
+  retention_in_days: 1
+  skip_destroy: false
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Logs will show OOM kills when memory is reduced to 1024MB
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-logs
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Logs will show OOM kills when memory is reduced to 1024MB
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-logs
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_group.app[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_group.app[0]
+ aws_cloudwatch_log_metric_filter › module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_metric_filter.memory_pressure[0]
--- current
+++ proposed
@@ -0,0 +1,16 @@
+type: aws_cloudwatch_log_metric_filter
+id: github.com/overmindtech/terraform-example.aws_cloudwatch_log_metric_filter.module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_metric_filter.memory_pressure[0]
+attributes:
+  id: (known after apply)
+  log_group_name: /ecs/scenarios--a3ec77f7
+  metric_transformation:
+    - default_value: null
+      dimensions: null
+      name: JavaOOMErrors
+      namespace: MemoryOptimization/Demo
+      unit: None
+      value: "1"
+  name: scenarios--a3ec77f7-memory-pressure
+  pattern: '[timestamp, requestId, level="ERROR", message="*OutOfMemoryError*"]'
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_metric_filter.memory_pressure[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_cloudwatch_log_metric_filter.memory_pressure[0]
+ cloudwatch-alarm › module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_cpu_utilization[0]
--- current
+++ proposed
@@ -0,0 +1,63 @@
+type: cloudwatch-alarm
+id: github.com/overmindtech/terraform-example.cloudwatch-alarm.module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_cpu_utilization[0]
+attributes:
+  actions_enabled: true
+  alarm_actions: (known after apply)
+  alarm_description: This metric monitors ECS CPU utilization - will spike when JVM struggles with insufficient memory
+  alarm_name: scenarios--a3ec77f7-high-cpu
+  arn: (known after apply)
+  comparison_operator: GreaterThanThreshold
+  datapoints_to_alarm: null
+  dimensions:
+    ClusterName: scenarios--a3ec77f7-cluster
+    ServiceName: scenarios--a3ec77f7-service
+  evaluate_low_sample_count_percentiles: (known after apply)
+  evaluation_periods: 3
+  extended_statistic: null
+  id: (known after apply)
+  insufficient_data_actions: null
+  metric_name: CPUUtilization
+  namespace: AWS/ECS
+  ok_actions: null
+  period: 300
+  statistic: Average
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: CPU utilization alarm for Java application performance
+    Environment: demo
+    GCPressure: high-when-heap-approaches-limit
+    JVMBehavior: CPU-spikes-before-OOM
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    MemoryThrashing: frequent-GC-when-constrained
+    Name: scenarios--a3ec77f7-cpu-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: CPU utilization alarm for Java application performance
+    Environment: demo
+    GCPressure: high-when-heap-approaches-limit
+    JVMBehavior: CPU-spikes-before-OOM
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    MemoryThrashing: frequent-GC-when-constrained
+    Name: scenarios--a3ec77f7-cpu-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_cpu_utilization[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_cpu_utilization[0]
+  threshold: 80
+  threshold_metric_id: null
+  treat_missing_data: missing
+  unit: null
+ cloudwatch-alarm › module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_memory_utilization[0]
--- current
+++ proposed
@@ -0,0 +1,63 @@
+type: cloudwatch-alarm
+id: github.com/overmindtech/terraform-example.cloudwatch-alarm.module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_memory_utilization[0]
+attributes:
+  actions_enabled: true
+  alarm_actions: (known after apply)
+  alarm_description: This metric monitors ECS memory utilization - WILL FIRE when containers run out of memory
+  alarm_name: scenarios--a3ec77f7-high-memory
+  arn: (known after apply)
+  comparison_operator: GreaterThanThreshold
+  datapoints_to_alarm: null
+  dimensions:
+    ClusterName: scenarios--a3ec77f7-cluster
+    ServiceName: scenarios--a3ec77f7-service
+  evaluate_low_sample_count_percentiles: (known after apply)
+  evaluation_periods: 2
+  extended_statistic: null
+  id: (known after apply)
+  insufficient_data_actions: null
+  metric_name: MemoryUtilization
+  namespace: AWS/ECS
+  ok_actions: (known after apply)
+  period: 300
+  statistic: Average
+  tags:
+    AlarmTrigger: memory-over-80-percent
+    ContainerMemoryMB: "1024"
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Memory utilization alarm for Java application
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-memory-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    WillFireAfterChange: "true"
+  tags_all:
+    AlarmTrigger: memory-over-80-percent
+    ContainerMemoryMB: "1024"
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Memory utilization alarm for Java application
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-memory-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    WillFireAfterChange: "true"
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_memory_utilization[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.high_memory_utilization[0]
+  threshold: 80
+  threshold_metric_id: null
+  treat_missing_data: missing
+  unit: null
+ cloudwatch-alarm › module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.low_task_count[0]
--- current
+++ proposed
@@ -0,0 +1,65 @@
+type: cloudwatch-alarm
+id: github.com/overmindtech/terraform-example.cloudwatch-alarm.module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.low_task_count[0]
+attributes:
+  actions_enabled: true
+  alarm_actions: (known after apply)
+  alarm_description: This metric monitors ECS running task count - WILL FIRE when containers crash due to OOM
+  alarm_name: scenarios--a3ec77f7-low-task-count
+  arn: (known after apply)
+  comparison_operator: LessThanThreshold
+  datapoints_to_alarm: null
+  dimensions:
+    ClusterName: scenarios--a3ec77f7-cluster
+    ServiceName: scenarios--a3ec77f7-service
+  evaluate_low_sample_count_percentiles: (known after apply)
+  evaluation_periods: 2
+  extended_statistic: null
+  id: (known after apply)
+  insufficient_data_actions: null
+  metric_name: RunningTaskCount
+  namespace: AWS/ECS
+  ok_actions: (known after apply)
+  period: 300
+  statistic: Average
+  tags:
+    BusinessImpact: service-degradation
+    CrashCause: OOM-when-memory-reduced
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Task count alarm for container health monitoring
+    Environment: demo
+    ExpectedTasks: "3"
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-task-count-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    ThresholdTasks: "2.4"
+  tags_all:
+    BusinessImpact: service-degradation
+    CrashCause: OOM-when-memory-reduced
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Task count alarm for container health monitoring
+    Environment: demo
+    ExpectedTasks: "3"
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-task-count-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    ThresholdTasks: "2.4"
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.low_task_count[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.low_task_count[0]
+  threshold: 2.4
+  threshold_metric_id: null
+  treat_missing_data: missing
+  unit: null
+ cloudwatch-alarm › module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.unhealthy_targets[0]
--- current
+++ proposed
@@ -0,0 +1,63 @@
+type: cloudwatch-alarm
+id: github.com/overmindtech/terraform-example.cloudwatch-alarm.module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.unhealthy_targets[0]
+attributes:
+  actions_enabled: true
+  alarm_actions: (known after apply)
+  alarm_description: This metric monitors ALB unhealthy targets - will fire when containers become unresponsive
+  alarm_name: scenarios--a3ec77f7-unhealthy-targets
+  arn: (known after apply)
+  comparison_operator: GreaterThanThreshold
+  datapoints_to_alarm: null
+  dimensions: (known after apply)
+  evaluate_low_sample_count_percentiles: (known after apply)
+  evaluation_periods: 2
+  extended_statistic: null
+  id: (known after apply)
+  insufficient_data_actions: null
+  metric_name: UnHealthyHostCount
+  namespace: AWS/ApplicationELB
+  ok_actions: null
+  period: 60
+  statistic: Average
+  tags:
+    BusinessRisk: outage-before-peak-season
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    DeregistrationTime: 5s
+    Description: ALB target health monitoring for application availability
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-unhealthy-targets-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    RollbackCapability: insufficient
+    Scenario: cost-reduction
+    UserExperience: failed-requests-during-crashes
+  tags_all:
+    BusinessRisk: outage-before-peak-season
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    DeregistrationTime: 5s
+    Description: ALB target health monitoring for application availability
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-unhealthy-targets-alarm
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    RollbackCapability: insufficient
+    Scenario: cost-reduction
+    UserExperience: failed-requests-during-crashes
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.unhealthy_targets[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_cloudwatch_metric_alarm.unhealthy_targets[0]
+  threshold: 0
+  threshold_metric_id: null
+  treat_missing_data: missing
+  unit: null
+ aws_cloudwatch_query_definition › module.scenarios[0].module.memory_optimization.aws_cloudwatch_query_definition.oom_events[0]
--- current
+++ proposed
@@ -0,0 +1,15 @@
+type: aws_cloudwatch_query_definition
+id: github.com/overmindtech/terraform-example.aws_cloudwatch_query_definition.module.scenarios[0].module.memory_optimization.aws_cloudwatch_query_definition.oom_events[0]
+attributes:
+  id: (known after apply)
+  log_group_names:
+    - /ecs/scenarios--a3ec77f7
+  name: scenarios--a3ec77f7-oom-analysis
+  query_definition_id: (known after apply)
+  query_string: |
+    fields @timestamp, @message
+    | filter @message like /OutOfMemoryError/
+    | sort @timestamp desc
+    | limit 100
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_cloudwatch_query_definition.oom_events[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_cloudwatch_query_definition.oom_events[0]
+ aws_ecs_cluster › module.scenarios[0].module.memory_optimization.aws_ecs_cluster.main[0]
--- current
+++ proposed
@@ -0,0 +1,39 @@
+type: aws_ecs_cluster
+id: github.com/overmindtech/terraform-example.aws_ecs_cluster.module.scenarios[0].module.memory_optimization.aws_ecs_cluster.main[0]
+attributes:
+  arn: (known after apply)
+  id: (known after apply)
+  name: scenarios--a3ec77f7-cluster
+  setting:
+    - name: containerInsights
+      value: disabled
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: ECS cluster for memory optimization demo - all 3 containers will restart on memory change
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-cluster
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: ECS cluster for memory optimization demo - all 3 containers will restart on memory change
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-cluster
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_ecs_cluster.main[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_ecs_cluster.main[0]
+ aws_ecs_service › module.scenarios[0].module.memory_optimization.aws_ecs_service.app[0]
--- current
+++ proposed
@@ -0,0 +1,75 @@
+type: aws_ecs_service
+id: github.com/overmindtech/terraform-example.aws_ecs_service.module.scenarios[0].module.memory_optimization.aws_ecs_service.app[0]
+attributes:
+  availability_zone_rebalancing: DISABLED
+  cluster: (known after apply)
+  deployment_circuit_breaker:
+    - enable: false
+      rollback: false
+  deployment_controller:
+    - type: ECS
+  deployment_maximum_percent: 200
+  deployment_minimum_healthy_percent: 100
+  desired_count: 3
+  enable_ecs_managed_tags: false
+  enable_execute_command: false
+  force_delete: null
+  force_new_deployment: null
+  health_check_grace_period_seconds: null
+  iam_role: (known after apply)
+  id: (known after apply)
+  launch_type: FARGATE
+  load_balancer:
+    - container_name: tomcat-app
+      container_port: 8080
+      target_group_arn: (known after apply)
+  name: scenarios--a3ec77f7-service
+  network_configuration:
+    - assign_public_ip: true
+      security_groups: (known after apply)
+      subnets:
+        - subnet-016bfadacc9c60bfc
+        - subnet-0b805a32f5d7f0c7b
+  platform_version: (known after apply)
+  propagate_tags: null
+  scheduling_strategy: REPLICA
+  tags:
+    BusinessContext: cost-optimization
+    ContainersAffected: "3"
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    DeploymentType: rolling
+    Description: ECS service running Java application containers
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-service
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    BusinessContext: cost-optimization
+    ContainersAffected: "3"
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    DeploymentType: rolling
+    Description: ECS service running Java application containers
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-service
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  task_definition: (known after apply)
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_ecs_service.app[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_ecs_service.app[0]
+  timeouts: null
+  triggers: (known after apply)
+  wait_for_steady_state: false
+ ecs-task-definition › module.scenarios[0].module.memory_optimization.aws_ecs_task_definition.app[0]
--- current
+++ proposed
@@ -0,0 +1,61 @@
+type: ecs-task-definition
+id: github.com/overmindtech/terraform-example.ecs-task-definition.module.scenarios[0].module.memory_optimization.aws_ecs_task_definition.app[0]
+attributes:
+  arn: (known after apply)
+  arn_without_revision: (known after apply)
+  container_definitions: '[{"environment":[{"name":"CATALINA_OPTS","value":"-Djava.security.egd=file:/dev/./urandom"},{"name":"JAVA_OPTS","value":"-Xmx1536m -Xms1536m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"}],"essential":true,"healthCheck":{"command":["CMD-SHELL","curl -f http://localhost:8080/ || exit 1"],"interval":30,"retries":3,"startPeriod":120,"timeout":5},"image":"tomcat:9-jre11","logConfiguration":{"logDriver":"awslogs","options":{"awslogs-group":"/ecs/scenarios--a3ec77f7","awslogs-region":"eu-west-2","awslogs-stream-prefix":"ecs"}},"memoryReservation":800,"name":"tomcat-app","portMappings":[{"containerPort":8080,"hostPort":8080,"protocol":"tcp"}]}]'
+  cpu: "512"
+  enable_fault_injection: (known after apply)
+  execution_role_arn: (known after apply)
+  family: scenarios--a3ec77f7-task
+  id: (known after apply)
+  ipc_mode: null
+  memory: "1024"
+  network_mode: awsvpc
+  pid_mode: null
+  requires_compatibilities:
+    - FARGATE
+  revision: (known after apply)
+  skip_destroy: false
+  tags:
+    ContainerMemoryMB: "1024"
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: ECS task definition with Java heap configuration
+    Environment: demo
+    JavaHeapMB: "1536"
+    JavaHeapSizeMB: "1536"
+    MemoryMB: "1024"
+    MemoryOptimized: "true"
+    MemoryOverheadMB: "256"
+    Name: scenarios--a3ec77f7-task
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    TotalRequiredMB: "1792"
+  tags_all:
+    ContainerMemoryMB: "1024"
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: ECS task definition with Java heap configuration
+    Environment: demo
+    JavaHeapMB: "1536"
+    JavaHeapSizeMB: "1536"
+    MemoryMB: "1024"
+    MemoryOptimized: "true"
+    MemoryOverheadMB: "256"
+    Name: scenarios--a3ec77f7-task
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    TotalRequiredMB: "1792"
+  task_role_arn: (known after apply)
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_ecs_task_definition.app[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_ecs_task_definition.app[0]
+  track_latest: false
+ aws_iam_role › module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_execution_role[0]
--- current
+++ proposed
@@ -0,0 +1,43 @@
+type: aws_iam_role
+id: github.com/overmindtech/terraform-example.aws_iam_role.module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_execution_role[0]
+attributes:
+  arn: (known after apply)
+  assume_role_policy: '{"Statement":[{"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":"ecs-tasks.amazonaws.com"}}],"Version":"2012-10-17"}'
+  create_date: (known after apply)
+  description: null
+  force_detach_policies: false
+  id: (known after apply)
+  inline_policy: (known after apply)
+  managed_policy_arns: (known after apply)
+  max_session_duration: 3600
+  name: scenarios--a3ec77f7-ecs-execution-role
+  name_prefix: (known after apply)
+  path: /
+  permissions_boundary: null
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_execution_role[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_execution_role[0]
+  unique_id: (known after apply)
+ aws_iam_role › module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_task_role[0]
--- current
+++ proposed
@@ -0,0 +1,43 @@
+type: aws_iam_role
+id: github.com/overmindtech/terraform-example.aws_iam_role.module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_task_role[0]
+attributes:
+  arn: (known after apply)
+  assume_role_policy: '{"Statement":[{"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":"ecs-tasks.amazonaws.com"}}],"Version":"2012-10-17"}'
+  create_date: (known after apply)
+  description: null
+  force_detach_policies: false
+  id: (known after apply)
+  inline_policy: (known after apply)
+  managed_policy_arns: (known after apply)
+  max_session_duration: 3600
+  name: scenarios--a3ec77f7-ecs-task-role
+  name_prefix: (known after apply)
+  path: /
+  permissions_boundary: null
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_task_role[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_iam_role.ecs_task_role[0]
+  unique_id: (known after apply)
+ aws_iam_role_policy_attachment › module.scenarios[0].module.memory_optimization.aws_iam_role_policy_attachment.ecs_execution_role_policy[0]
--- current
+++ proposed
@@ -0,0 +1,8 @@
+type: aws_iam_role_policy_attachment
+id: github.com/overmindtech/terraform-example.aws_iam_role_policy_attachment.module.scenarios[0].module.memory_optimization.aws_iam_role_policy_attachment.ecs_execution_role_policy[0]
+attributes:
+  id: (known after apply)
+  policy_arn: arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
+  role: scenarios--a3ec77f7-ecs-execution-role
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_iam_role_policy_attachment.ecs_execution_role_policy[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_iam_role_policy_attachment.ecs_execution_role_policy[0]
+ aws_lb › module.scenarios[0].module.memory_optimization.aws_lb.app[0]
--- current
+++ proposed
@@ -0,0 +1,70 @@
+type: aws_lb
+id: github.com/overmindtech/terraform-example.aws_lb.module.scenarios[0].module.memory_optimization.aws_lb.app[0]
+attributes:
+  arn: (known after apply)
+  arn_suffix: (known after apply)
+  client_keep_alive: 3600
+  customer_owned_ipv4_pool: null
+  desync_mitigation_mode: defensive
+  dns_name: (known after apply)
+  dns_record_client_routing_policy: null
+  drop_invalid_header_fields: false
+  enable_cross_zone_load_balancing: null
+  enable_deletion_protection: false
+  enable_http2: true
+  enable_tls_version_and_cipher_suite_headers: false
+  enable_waf_fail_open: false
+  enable_xff_client_port: false
+  enable_zonal_shift: false
+  enforce_security_group_inbound_rules_on_private_link_traffic: (known after apply)
+  id: (known after apply)
+  idle_timeout: 60
+  internal: false
+  ip_address_type: (known after apply)
+  load_balancer_type: application
+  name: scenarios--a3ec77f7-alb
+  name_prefix: (known after apply)
+  preserve_host_header: false
+  security_groups: (known after apply)
+  subnet_mapping: (known after apply)
+  subnets:
+    - subnet-016bfadacc9c60bfc
+    - subnet-0b805a32f5d7f0c7b
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: ALB for memory optimization demo - will route to failing containers after memory change
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-alb
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    context:black-friday-traffic: 10x normal load expected
+    context:capacity-planning: load balancer configured for high traffic
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: ALB for memory optimization demo - will route to failing containers after memory change
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-alb
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    context:black-friday-traffic: 10x normal load expected
+    context:capacity-planning: load balancer configured for high traffic
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_lb.app[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_lb.app[0]
+  timeouts: null
+  vpc_id: (known after apply)
+  xff_header_processing_mode: append
+  zone_id: (known after apply)
+ aws_lb_listener › module.scenarios[0].module.memory_optimization.aws_lb_listener.app[0]
--- current
+++ proposed
@@ -0,0 +1,69 @@
+type: aws_lb_listener
+id: github.com/overmindtech/terraform-example.aws_lb_listener.module.scenarios[0].module.memory_optimization.aws_lb_listener.app[0]
+attributes:
+  alpn_policy: null
+  arn: (known after apply)
+  certificate_arn: null
+  default_action:
+    - forward:
+        - target_group:
+            - arn: (known after apply)
+              weight: 1
+      order: (known after apply)
+      target_group_arn: null
+      type: forward
+  id: (known after apply)
+  load_balancer_arn: (known after apply)
+  mutual_authentication: (known after apply)
+  port: 80
+  protocol: HTTP
+  routing_http_request_x_amzn_mtls_clientcert_header_name: (known after apply)
+  routing_http_request_x_amzn_mtls_clientcert_issuer_header_name: (known after apply)
+  routing_http_request_x_amzn_mtls_clientcert_leaf_header_name: (known after apply)
+  routing_http_request_x_amzn_mtls_clientcert_serial_number_header_name: (known after apply)
+  routing_http_request_x_amzn_mtls_clientcert_subject_header_name: (known after apply)
+  routing_http_request_x_amzn_mtls_clientcert_validity_header_name: (known after apply)
+  routing_http_request_x_amzn_tls_cipher_suite_header_name: (known after apply)
+  routing_http_request_x_amzn_tls_version_header_name: (known after apply)
+  routing_http_response_access_control_allow_credentials_header_value: (known after apply)
+  routing_http_response_access_control_allow_headers_header_value: (known after apply)
+  routing_http_response_access_control_allow_methods_header_value: (known after apply)
+  routing_http_response_access_control_allow_origin_header_value: (known after apply)
+  routing_http_response_access_control_expose_headers_header_value: (known after apply)
+  routing_http_response_access_control_max_age_header_value: (known after apply)
+  routing_http_response_content_security_policy_header_value: (known after apply)
+  routing_http_response_server_enabled: (known after apply)
+  routing_http_response_strict_transport_security_header_value: (known after apply)
+  routing_http_response_x_content_type_options_header_value: (known after apply)
+  routing_http_response_x_frame_options_header_value: (known after apply)
+  ssl_policy: (known after apply)
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-listener
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-listener
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tcp_idle_timeout_seconds: (known after apply)
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_lb_listener.app[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_lb_listener.app[0]
+  timeouts: null
+ aws_lb_target_group › module.scenarios[0].module.memory_optimization.aws_lb_target_group.app[0]
--- current
+++ proposed
@@ -0,0 +1,74 @@
+type: aws_lb_target_group
+id: github.com/overmindtech/terraform-example.aws_lb_target_group.module.scenarios[0].module.memory_optimization.aws_lb_target_group.app[0]
+attributes:
+  arn: (known after apply)
+  arn_suffix: (known after apply)
+  connection_termination: (known after apply)
+  deregistration_delay: "5"
+  health_check:
+    - enabled: true
+      healthy_threshold: 2
+      interval: 30
+      matcher: "200"
+      path: /
+      port: traffic-port
+      protocol: HTTP
+      timeout: 5
+      unhealthy_threshold: 2
+  id: (known after apply)
+  ip_address_type: (known after apply)
+  lambda_multi_value_headers_enabled: false
+  load_balancer_arns: (known after apply)
+  load_balancing_algorithm_type: (known after apply)
+  load_balancing_anomaly_mitigation: (known after apply)
+  load_balancing_cross_zone_enabled: (known after apply)
+  name: scenarios--a3ec77f7-tg
+  name_prefix: (known after apply)
+  port: 8080
+  preserve_client_ip: (known after apply)
+  protocol: HTTP
+  protocol_version: (known after apply)
+  proxy_protocol_v2: false
+  slow_start: 0
+  stickiness: (known after apply)
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Target group with 5s deregistration - NO TIME FOR ROLLBACK!
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-tg
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    risk:black-friday-timing: change 7 days before peak
+    risk:deregistration-delay: 5s
+    risk:rollback-capability: none
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: Target group with 5s deregistration - NO TIME FOR ROLLBACK!
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-tg
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+    risk:black-friday-timing: change 7 days before peak
+    risk:deregistration-delay: 5s
+    risk:rollback-capability: none
+  target_failover: (known after apply)
+  target_group_health: (known after apply)
+  target_health_state: (known after apply)
+  target_type: ip
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_lb_target_group.app[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_lb_target_group.app[0]
+  vpc_id: vpc-0f4ddbf8c33e5c725
+ aws_sns_topic › module.scenarios[0].module.memory_optimization.aws_sns_topic.alerts[0]
--- current
+++ proposed
@@ -0,0 +1,64 @@
+type: aws_sns_topic
+id: github.com/overmindtech/terraform-example.aws_sns_topic.module.scenarios[0].module.memory_optimization.aws_sns_topic.alerts[0]
+attributes:
+  application_failure_feedback_role_arn: null
+  application_success_feedback_role_arn: null
+  application_success_feedback_sample_rate: null
+  archive_policy: null
+  arn: (known after apply)
+  beginning_archive_time: (known after apply)
+  content_based_deduplication: false
+  delivery_policy: null
+  display_name: null
+  fifo_throughput_scope: (known after apply)
+  fifo_topic: false
+  firehose_failure_feedback_role_arn: null
+  firehose_success_feedback_role_arn: null
+  firehose_success_feedback_sample_rate: null
+  http_failure_feedback_role_arn: null
+  http_success_feedback_role_arn: null
+  http_success_feedback_sample_rate: null
+  id: (known after apply)
+  kms_master_key_id: null
+  lambda_failure_feedback_role_arn: null
+  lambda_success_feedback_role_arn: null
+  lambda_success_feedback_sample_rate: null
+  name: scenarios--a3ec77f7-alerts
+  name_prefix: (known after apply)
+  owner: (known after apply)
+  policy: (known after apply)
+  signature_version: (known after apply)
+  sqs_failure_feedback_role_arn: null
+  sqs_success_feedback_role_arn: null
+  sqs_success_feedback_sample_rate: null
+  tags:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: SNS topic for memory optimization demo alerts - will fire when containers OOM
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-alerts
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  tags_all:
+    CreatedBy: terraform
+    DaysUntilBF: "7"
+    Description: SNS topic for memory optimization demo alerts - will fire when containers OOM
+    Environment: demo
+    JavaHeapMB: "1536"
+    MemoryMB: "1024"
+    Name: scenarios--a3ec77f7-alerts
+    OptimizationWorks: "false"
+    Project: memory-optimization
+    Purpose: production-optimization
+    RequiredMemoryMB: "1792"
+    RiskLevel: high
+    Scenario: cost-reduction
+  terraform_address: module.scenarios[0].module.memory_optimization.aws_sns_topic.alerts[0]
+  terraform_name: module.scenarios[0].module.memory_optimization.aws_sns_topic.alerts[0]
+  tracing_config: (known after apply)

💥 Blast Radius

Items 2

Edges 1

@jameslaneovermind jameslaneovermind merged commit 84a6023 into main Sep 23, 2025
4 of 5 checks passed
@jameslaneovermind jameslaneovermind deleted the feature/memory-cost-optimization branch September 23, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants