autoscaling

This commit is contained in:
dzikafoczka 2024-12-21 11:55:49 +01:00
parent 0fa568fbe1
commit d37963d628

View File

@ -272,7 +272,7 @@ def put_scaling_policies(autoscaling_client, asg_arn):
PolicyType='SimpleScaling', PolicyType='SimpleScaling',
AdjustmentType='ChangeInCapacity', AdjustmentType='ChangeInCapacity',
ScalingAdjustment=1, ScalingAdjustment=1,
Cooldown=90 Cooldown=60
) )
print(f"Scale policy created with ARN: {up['PolicyARN']}") print(f"Scale policy created with ARN: {up['PolicyARN']}")
@ -284,7 +284,7 @@ def put_scaling_policies(autoscaling_client, asg_arn):
PolicyType='SimpleScaling', PolicyType='SimpleScaling',
AdjustmentType='ChangeInCapacity', AdjustmentType='ChangeInCapacity',
ScalingAdjustment=-1, ScalingAdjustment=-1,
Cooldown=90 Cooldown=60
) )
print(f"Scale policy created with ARN: {down['PolicyARN']}") 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", AlarmName=f"{PREFIX}-scale-alarm",
ComparisonOperator='GreaterThanThreshold', ComparisonOperator='GreaterThanThreshold',
EvaluationPeriods=1, EvaluationPeriods=1,
MetricName='RequestCount', MetricName='RequestCountPerTarget',
Namespace='AWS/ApplicationELB', Namespace='AWS/ApplicationELB',
Period=60, Period=60,
Statistic='Sum', Statistic='Sum',
@ -318,7 +318,7 @@ def create_cloudwatch_alarms(cloudwatch_client, sp_up, sp_down):
AlarmName=f"{PREFIX}-scale-down-alarm", AlarmName=f"{PREFIX}-scale-down-alarm",
ComparisonOperator='LessThanThreshold', ComparisonOperator='LessThanThreshold',
EvaluationPeriods=1, EvaluationPeriods=1,
MetricName='RequestCount', MetricName='RequestCountPerTarget',
Namespace='AWS/ApplicationELB', Namespace='AWS/ApplicationELB',
Period=60, Period=60,
Statistic='Average', Statistic='Average',