From d37963d628a7c16d064e076ba467325c16f4399d Mon Sep 17 00:00:00 2001 From: dzikafoczka Date: Sat, 21 Dec 2024 11:55:49 +0100 Subject: [PATCH] autoscaling --- autoscaling.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoscaling.py b/autoscaling.py index 8315d20..73e6a82 100644 --- a/autoscaling.py +++ b/autoscaling.py @@ -272,7 +272,7 @@ def put_scaling_policies(autoscaling_client, asg_arn): PolicyType='SimpleScaling', AdjustmentType='ChangeInCapacity', ScalingAdjustment=1, - Cooldown=90 + Cooldown=60 ) print(f"Scale policy created with ARN: {up['PolicyARN']}") @@ -284,7 +284,7 @@ def put_scaling_policies(autoscaling_client, asg_arn): PolicyType='SimpleScaling', AdjustmentType='ChangeInCapacity', ScalingAdjustment=-1, - Cooldown=90 + Cooldown=60 ) print(f"Scale policy created with ARN: {down['PolicyARN']}") @@ -296,7 +296,7 @@ def create_cloudwatch_alarms(cloudwatch_client, sp_up, sp_down): AlarmName=f"{PREFIX}-scale-alarm", ComparisonOperator='GreaterThanThreshold', EvaluationPeriods=1, - MetricName='RequestCount', + MetricName='RequestCountPerTarget', Namespace='AWS/ApplicationELB', Period=60, Statistic='Sum', @@ -318,7 +318,7 @@ def create_cloudwatch_alarms(cloudwatch_client, sp_up, sp_down): AlarmName=f"{PREFIX}-scale-down-alarm", ComparisonOperator='LessThanThreshold', EvaluationPeriods=1, - MetricName='RequestCount', + MetricName='RequestCountPerTarget', Namespace='AWS/ApplicationELB', Period=60, Statistic='Average',