import boto3 import json def lambda_handler(event, context): asgClient = boto3.client('autoscaling', region_name="ap-southeast-1") response = asgClient.describe_auto_scaling_groups() print(response) asgs = response['AutoScalingGroups'] for asg in asgs: asgName = asg['AutoScalingGroupName'] if 'seed' not in asgName: continue print("process asg {}".format(asgName) ) asgClient.set_desired_capacity( AutoScalingGroupName=asgName, DesiredCapacity=1, HonorCooldown=False ) return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') }