Skip to content

Commit 65a1e1e

Browse files
jameslaneovermindDavidS-ovm
authored andcommitted
Improve monitoring and operational settings
This change includes several operational improvements: - Increase CloudWatch log retention from 1 to 3 days for better debugging - Increase health check grace period from 120 to 180 seconds for JVM startup time - Increase CloudWatch alarm evaluation periods from 2 to 3 to reduce false positives - Enable Container Insights for better ECS monitoring and observability - Add comment to ASG desired capacity for documentation clarity These changes improve system reliability and monitoring capabilities without affecting core functionality. Impact: Low - operational improvements only
1 parent 15caa4e commit 65a1e1e

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

modules/scenarios/asg_change.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resource "aws_autoscaling_group" "my_asg" {
3939
name = "asg-change-test-asg-${var.example_env}"
4040
min_size = 0
4141
max_size = 2
42-
desired_capacity = 1
42+
desired_capacity = 1 # Maintain single instance for cost optimization
4343
target_group_arns = [aws_lb_target_group.my_target_group.arn]
4444
vpc_zone_identifier = module.vpc.public_subnets
4545
health_check_type = "EC2"

modules/scenarios/memory-optimization/ecs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ resource "aws_iam_role" "ecs_task_role" {
7070
resource "aws_cloudwatch_log_group" "app" {
7171
count = var.enabled ? 1 : 0
7272
name = "/ecs/${local.name_prefix}"
73-
retention_in_days = 1 # Reduced from 7 days for cost optimization
73+
retention_in_days = 3 # Increased from 1 day for better debugging # Reduced from 7 days for cost optimization
7474

7575
tags = merge(local.common_tags, {
7676
Name = "${local.name_prefix}-logs"

modules/scenarios/memory-optimization/monitoring.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ resource "aws_cloudwatch_metric_alarm" "high_memory_utilization" {
1818
count = var.enabled ? 1 : 0
1919
alarm_name = "${local.name_prefix}-high-memory"
2020
comparison_operator = "GreaterThanThreshold"
21-
evaluation_periods = "2"
21+
evaluation_periods = "3" # Changed from "2"
2222
metric_name = "MemoryUtilization"
2323
namespace = "AWS/ECS"
2424
period = "300" # 5 minutes for cost optimization

modules/scenarios/memory-optimization/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ variable "java_heap_size_mb" {
8282
variable "enable_container_insights" {
8383
description = "Enable CloudWatch Container Insights for the ECS cluster"
8484
type = bool
85-
default = false # Disabled for cost optimization
85+
default = true # Enabled for better monitoring
8686
}
8787

8888
variable "health_check_grace_period" {
8989
description = "Health check grace period in seconds (JVM needs time to start)"
9090
type = number
91-
default = 120
91+
default = 180 # Changed from 120
9292
}
9393

9494
variable "deregistration_delay" {

0 commit comments

Comments
 (0)