Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

names #11

Open
okanaiki opened this issue Jul 4, 2022 · 3 comments
Open

names #11

okanaiki opened this issue Jul 4, 2022 · 3 comments

Comments

@okanaiki
Copy link

okanaiki commented Jul 4, 2022

resource "aws_appautoscaling_policy" "ecs_policy"
resource "aws_appautoscaling_target" "ecs_target"

Hi. This should be used to make it work on ECS

Thanks for the modules!

@jnonino
Copy link
Member

jnonino commented Jul 5, 2022

Hi @okanaiki, thanks for your message, glad you find the modules useful. I don't understand the message, is there anything not working?

@okanaiki
Copy link
Author

okanaiki commented Jul 5, 2022

In this setup to make it work as expected i changed to

resource "aws_appautoscaling_policy" "ecs_policy"
resource "aws_appautoscaling_target" "ecs_target"

from

resource "aws_appautoscaling_policy" "scale_down_policy"
resource "aws_appautoscaling_policy" "scale_up_policy"
resource "aws_appautoscaling_target" "scale_target"

and added this variables
min_capacity = var.scale_target_min_capacity
max_capacity = var.scale_target_max_capacity

to all the modules from setup to main https://github.com/cn-terraform/terraform-aws-ecs-fargate

then autoscaling for ecs start to work as expected

@okanaiki
Copy link
Author

okanaiki commented Jul 5, 2022

`
#------------------------------------------------------------------------------

AWS Auto Scaling - Scaling Up Policy

#------------------------------------------------------------------------------
resource "aws_appautoscaling_policy" "ecs_policy" {
name = "${var.name_prefix}-scale-up-policy"
depends_on = [aws_appautoscaling_target.ecs_target]
service_namespace = "ecs"
resource_id = "service/${var.ecs_cluster_name}/${var.ecs_service_name}"
scalable_dimension = "ecs:service:DesiredCount"
step_scaling_policy_configuration {
adjustment_type = "ChangeInCapacity"
cooldown = 60
metric_aggregation_type = "Maximum"
step_adjustment {
metric_interval_lower_bound = 0
scaling_adjustment = 1
}
}
}

#------------------------------------------------------------------------------

AWS Auto Scaling - Scaling Down Policy

#------------------------------------------------------------------------------
resource "aws_appautoscaling_policy" "ecs_policy" {
name = "${var.name_prefix}-scale-down-policy"
depends_on = [aws_appautoscaling_target.ecs_target]
service_namespace = "ecs"
resource_id = "service/${var.ecs_cluster_name}/${var.ecs_service_name}"
scalable_dimension = "ecs:service:DesiredCount"
step_scaling_policy_configuration {
adjustment_type = "ChangeInCapacity"
cooldown = 60
metric_aggregation_type = "Maximum"
step_adjustment {
metric_interval_upper_bound = 0
scaling_adjustment = -1
}
}
}

#------------------------------------------------------------------------------

AWS Auto Scaling - Scaling Target

#------------------------------------------------------------------------------
resource "aws_appautoscaling_target" "ecs_target" {
service_namespace = "ecs"
resource_id = "service/${var.ecs_cluster_name}/${var.ecs_service_name}"
scalable_dimension = "ecs:service:DesiredCount"
min_capacity = var.min_capacity
max_capacity = var.max_capacity
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants