in InstanceRefreshHandler/lambda_function.py [0:0]
def trigger_auto_scaling_instance_refresh(asg_name, strategy="Rolling",
min_healthy_percentage=90, instance_warmup=300):
try:
response = asg_client.start_instance_refresh(
AutoScalingGroupName=asg_name,
Strategy=strategy,
Preferences={
'MinHealthyPercentage': min_healthy_percentage,
'InstanceWarmup': instance_warmup
})
logging.info("Triggered Instance Refresh {} for Auto Scaling "
"group {}".format(response['InstanceRefreshId'], asg_name))
except ClientError as e:
logging.error("Unable to trigger Instance Refresh for "
"Auto Scaling group {}".format(asg_name))
raise e