in cloudformation/lambda_backup.py [0:0]
def abandon_lifecycle(life_cycle_hook, auto_scaling_group, instance_id):
asg_client = boto3.client('autoscaling')
try:
response = asg_client.complete_lifecycle_action(
LifecycleHookName=life_cycle_hook,
AutoScalingGroupName=auto_scaling_group,
LifecycleActionResult='ABANDON',
InstanceId=instance_id
)
if check_response(response):
logger.info("Lifecycle hook abandoned correctly: %s", response)
else:
logger.error("Lifecycle hook could not be abandoned: %s", response)
except Exception, e:
logger.error("Lifecycle hook abandon could not be executed: %s", str(e))
return None