From 4326c294068443a72c9a40a115dd5fcf7255aa70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Sat, 7 Dec 2024 00:20:48 +0200 Subject: [PATCH] infra: scale down (#160) --- terraform/database.tf | 8 ++++---- terraform/ecs.tf | 8 ++++---- terraform/elasticache.tf | 2 +- terraform/service_app.tf | 8 ++++---- terraform/service_horizon.tf | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/terraform/database.tf b/terraform/database.tf index 4da98df..130c0c0 100644 --- a/terraform/database.tf +++ b/terraform/database.tf @@ -1,11 +1,11 @@ resource "aws_db_instance" "main" { identifier = local.namespace db_name = "rezultatevot" - instance_class = var.env == "production" ? "db.m7g.4xlarge" : "db.t4g.micro" + instance_class = "db.t4g.micro" publicly_accessible = false multi_az = true deletion_protection = true - monitoring_interval = 60 + # monitoring_interval = 60 # availability_zone = local.availability_zone @@ -35,8 +35,8 @@ resource "aws_db_instance" "main" { maintenance_window = "Tue:04:45-Tue:06:00" - performance_insights_enabled = true - performance_insights_retention_period = 7 + # performance_insights_enabled = false + # performance_insights_retention_period = 7 db_subnet_group_name = aws_db_subnet_group.db_subnet_group.name vpc_security_group_ids = [aws_security_group.database.id] diff --git a/terraform/ecs.tf b/terraform/ecs.tf index 8df73d1..b5bb5d4 100644 --- a/terraform/ecs.tf +++ b/terraform/ecs.tf @@ -5,13 +5,13 @@ module "ecs_cluster" { vpc_id = aws_vpc.main.id ecs_subnets = aws_subnet.private.*.id # ecs_subnets = [aws_subnet.private.0.id] security_groups = [aws_security_group.ecs.id] - default_instance_type = "c6a.xlarge" + default_instance_type = "t3a.micro" instance_types = { - "c6a.xlarge" = "" + "t3a.micro" = "" } - min_size = 3 - max_size = 24 + min_size = 1 + max_size = 3 minimum_scaling_step_size = 1 maximum_scaling_step_size = 1 diff --git a/terraform/elasticache.tf b/terraform/elasticache.tf index d7b40fd..af6aae1 100644 --- a/terraform/elasticache.tf +++ b/terraform/elasticache.tf @@ -1,7 +1,7 @@ resource "aws_elasticache_cluster" "main" { cluster_id = local.namespace engine = "redis" - node_type = "cache.r7g.xlarge" + node_type = "cache.t4g.small" num_cache_nodes = 1 parameter_group_name = "default.redis7" engine_version = "7.0" diff --git a/terraform/service_app.tf b/terraform/service_app.tf index bc84798..f11f556 100644 --- a/terraform/service_app.tf +++ b/terraform/service_app.tf @@ -7,8 +7,8 @@ module "ecs_app" { name = "${local.namespace}-app" cluster_name = module.ecs_cluster.cluster_name - min_capacity = 2 - max_capacity = 18 + min_capacity = 1 + max_capacity = 3 deployment_minimum_healthy_percent = 50 deployment_maximum_percent = 200 @@ -25,8 +25,8 @@ module "ecs_app" { lb_health_check_enabled = true lb_path = "/up" - container_memory_soft_limit = 768 - container_memory_hard_limit = 1536 + container_memory_soft_limit = 512 + container_memory_hard_limit = 1024 log_group_name = module.ecs_cluster.log_group_name service_discovery_namespace_id = module.ecs_cluster.service_discovery_namespace_id diff --git a/terraform/service_horizon.tf b/terraform/service_horizon.tf index c88e93f..a9a2d92 100644 --- a/terraform/service_horizon.tf +++ b/terraform/service_horizon.tf @@ -7,8 +7,8 @@ module "ecs_horizon" { name = "${local.namespace}-horizon" cluster_name = module.ecs_cluster.cluster_name - min_capacity = 1 - max_capacity = 1 + min_capacity = 0 + max_capacity = 0 deployment_minimum_healthy_percent = 0 deployment_maximum_percent = 100