From c5725929945630a5d8855ac690e7df4723362ebe Mon Sep 17 00:00:00 2001 From: zcemycl Date: Sun, 14 Jul 2024 11:38:18 +0100 Subject: [PATCH] update working ec2 mix fargate in ecs --- src/tf/aws-dagster/architectures/ec2.tf | 3 --- src/tf/aws-dagster/architectures/ecs-task.tf | 11 ++++++----- src/tf/aws-dagster/architectures/ecs.tf | 12 ------------ 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/tf/aws-dagster/architectures/ec2.tf b/src/tf/aws-dagster/architectures/ec2.tf index 2928183..1bf8dcf 100644 --- a/src/tf/aws-dagster/architectures/ec2.tf +++ b/src/tf/aws-dagster/architectures/ec2.tf @@ -63,14 +63,11 @@ resource "aws_launch_template" "this" { resource "aws_autoscaling_group" "this" { name = "${var.prefix}-asg-ec2-hotload" vpc_zone_identifier = [for name, obj in module.private_subnet.subnets : obj.id if length(regexall(".*dagster_nat.*", name)) > 0] - # launch_configuration = aws_launch_template.this.name launch_template { id = aws_launch_template.this.id version = "$Latest" } - - desired_capacity = 1 min_size = 1 max_size = 1 health_check_grace_period = 0 diff --git a/src/tf/aws-dagster/architectures/ecs-task.tf b/src/tf/aws-dagster/architectures/ecs-task.tf index 04605cb..e0f7973 100644 --- a/src/tf/aws-dagster/architectures/ecs-task.tf +++ b/src/tf/aws-dagster/architectures/ecs-task.tf @@ -96,14 +96,15 @@ resource "aws_service_discovery_service" "this_hotload" { } resource "aws_ecs_service" "this_hotload" { - name = "hotload-etl2" - # iam_role = aws_iam_role.this_srv.arn + name = "hotload-etl2" cluster = aws_ecs_cluster.this.id desired_count = 1 task_definition = aws_ecs_task_definition.this.arn - launch_type = "EC2" - # deployment_minimum_healthy_percent = 50 - # deployment_maximum_percent = 200 + + capacity_provider_strategy { + capacity_provider = aws_ecs_capacity_provider.this.name + weight = 100 + } network_configuration { security_groups = [module.security_groups.sg_ids["everything"].id] diff --git a/src/tf/aws-dagster/architectures/ecs.tf b/src/tf/aws-dagster/architectures/ecs.tf index e9c0677..a01acf2 100644 --- a/src/tf/aws-dagster/architectures/ecs.tf +++ b/src/tf/aws-dagster/architectures/ecs.tf @@ -93,18 +93,6 @@ resource "aws_ecs_cluster_capacity_providers" "cas" { } } -# resource "aws_ecs_cluster_capacity_providers" "example" { -# cluster_name = aws_ecs_cluster.this.name - -# capacity_providers = ["FARGATE"] - -# default_capacity_provider_strategy { -# base = 1 -# weight = 100 -# capacity_provider = "FARGATE" -# } -# } - module "ecs_srv_task" { source = "github.com/zcemycl/systemDeploy/src/tf/modules/ecs" prefix = var.prefix