Skip to content

Commit

Permalink
infra: scale down (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio authored Dec 6, 2024
1 parent cb7a729 commit 4326c29
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions terraform/database.tf
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions terraform/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion terraform/elasticache.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 4 additions & 4 deletions terraform/service_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions terraform/service_horizon.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4326c29

Please sign in to comment.