File tree Expand file tree Collapse file tree 5 files changed +29
-256
lines changed Expand file tree Collapse file tree 5 files changed +29
-256
lines changed Original file line number Diff line number Diff line change 11# ecs.tf
2- # Following guide.md requirements for memory optimization demo
3- # Create ECS resources showing Java heap trap from guide.md
4- # Java needs 1536MB heap but container will only have 1024MB after change
2+ # ECS infrastructure for Java Tomcat application
3+ # Production configuration with optimized memory allocation
54
65# ECS Cluster with container insights
76resource "aws_ecs_cluster" "main" {
Original file line number Diff line number Diff line change 11# monitoring.tf
2- # Following guide.md requirements for memory optimization demo
3- # Create CloudWatch alarms that will fire when containers OOM
4- # Reference the memory optimization scenario from guide.md
2+ # CloudWatch monitoring and alerting for Java application performance
3+ # Production-grade monitoring for ECS service health and resource utilization
54
65# SNS Topic for alarm notifications
76resource "aws_sns_topic" "alerts" {
Original file line number Diff line number Diff line change 11# variables.tf
2- # Following guide.md requirements for memory optimization demo
3- # Create variables for memory optimization demo as specified in guide.md
2+ # ECS Java application memory allocation configuration
3+ # Infrastructure variables for production memory optimization
44
55variable "enabled" {
6- description = " Toggle module on/off "
6+ description = " Enable the ECS service and associated infrastructure "
77 type = bool
88 default = true
99}
1010
1111variable "name_prefix" {
12- description = " Unique prefix for resources "
12+ description = " Resource naming prefix for consistent identification "
1313 type = string
14- default = " memory-opt-demo "
14+ default = " java-app "
1515}
1616
1717variable "container_memory" {
18- description = " Memory in MB allocated to each container (will change from 2048 to 1024 to break) "
18+ description = " Memory allocation per container in MB. Current monitoring shows 800MB average usage. "
1919 type = number
2020 default = 2048
2121
@@ -26,7 +26,7 @@ variable "container_memory" {
2626}
2727
2828variable "number_of_containers" {
29- description = " ECS service desired count - number of containers to run "
29+ description = " ECS service desired count for high availability and load distribution "
3030 type = number
3131 default = 15
3232
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,27 +5,37 @@ variable "example_env" {
55 type = string
66}
77
8- # Memory optimization demo variables
8+ # Java application memory optimization settings
99variable "enable_memory_optimization_demo" {
10- description = " Enable the memory optimization demo scenario "
10+ description = " Enable the Java application memory optimization in production "
1111 type = bool
12- default = true # Enable demo infrastructure
12+ default = true
1313}
1414
1515variable "memory_optimization_container_memory" {
16- description = " Memory allocation for containers in the demo (2048 = safe, 1024 = breaks) "
16+ description = " Memory allocation per ECS container in MB. Based on monitoring analysis showing 800MB average usage. "
1717 type = number
18- default = 1024 # Reduced from 2048MB to save costs
18+ default = 1024
19+
20+ validation {
21+ condition = var. memory_optimization_container_memory >= 512 && var. memory_optimization_container_memory <= 4096
22+ error_message = " Container memory must be between 512MB and 4GB."
23+ }
1924}
2025
2126variable "memory_optimization_container_count" {
22- description = " Number of containers to run in the memory optimization demo "
27+ description = " Number of ECS service instances for load distribution "
2328 type = number
24- default = 3 # Reduced from 15 to 3 for cost optimization
29+ default = 3
30+
31+ validation {
32+ condition = var. memory_optimization_container_count >= 1 && var. memory_optimization_container_count <= 50
33+ error_message = " Container count must be between 1 and 50."
34+ }
2535}
2636
2737variable "days_until_black_friday" {
28- description = " Days until Black Friday (demo context) "
38+ description = " Business context: Days remaining until Black Friday peak traffic period "
2939 type = number
3040 default = 7
3141}
You can’t perform that action at this time.
0 commit comments