Ran into some issues again as my lambda with the python code was redployed and now its not working as it was yesterday.
Basically the code wont change the ASG Max size past 10 if I just call Method3=Max and Value3=11 using my Api URL which is what I want.
However if I call all 3 Methods like this
Method1=Capacity&Value1=1&Method2=Min&Value2=1&Method3=Max&Value3=11
Or call the Max value with either Desired capacity or Min Value then the Max value will change to whatever Desired or Min are set as. For example
Method2=Min&Value2=1&Method3=Max&Value3=11 then for some reason Method2 is changing the value of Method3 to a value of 1 also
Here is my code as Im not sure why this is happening. Could you help with this?
Basically the code wont change the ASG Max size past 10 if I just call Method3=Max and Value3=11 using my Api URL which is what I want.
However if I call all 3 Methods like this
Method1=Capacity&Value1=1&Method2=Min&Value2=1&Method3=Max&Value3=11
Or call the Max value with either Desired capacity or Min Value then the Max value will change to whatever Desired or Min are set as. For example
Method2=Min&Value2=1&Method3=Max&Value3=11 then for some reason Method2 is changing the value of Method3 to a value of 1 also
Here is my code as Im not sure why this is happening. Could you help with this?
for autoscaling in allAutoScaling: for key in autoscaling: for tag in key['Tags']: if tag['Key'] == event['TagKey'] and tag['Value'] == event['TagValue']: try: Value = int(event['Value3']) except ValueError: print (f"{event['Value3']} is not a valid integer") else: if 1 <= Value <= 10: if event['Method3'] == "Max": if event['Value3']: Value3 = int(event['Value3']) response = client.update_auto_scaling_group( AutoScalingGroupName=key['AutoScalingGroupName'], MaxSize=Value3 ) else: print(f'Value must be between 1 and 3, got {Value} instead') if event['Method2'] == "Min": if event['Value2']: Value2 = int(event['Value2']) response = client.update_auto_scaling_group( AutoScalingGroupName=key['AutoScalingGroupName'], MaxSize=Value2 ) else: print('Max already at required level') if event['Method1'] == "Capacity": if event['Value1']: Value1 = int(event['Value1']) response = client.set_desired_capacity( AutoScalingGroupName=key['AutoScalingGroupName'], DesiredCapacity=Value1 ) else: print('Capacity already at required level')Edit: issue now resolved. Typo error for MaxSize=Value2 should be MinSize=Value2