Example usage for com.amazonaws.services.autoscaling.model PutLifecycleHookRequest setLifecycleHookName

List of usage examples for com.amazonaws.services.autoscaling.model PutLifecycleHookRequest setLifecycleHookName

Introduction

In this page you can find the example usage for com.amazonaws.services.autoscaling.model PutLifecycleHookRequest setLifecycleHookName.

Prototype


public void setLifecycleHookName(String lifecycleHookName) 

Source Link

Document

The name of the lifecycle hook.

Usage

From source file:com.pinterest.arcee.autoscaling.AwsAutoScaleGroupManager.java

License:Apache License

@Override
public void createLifecycleHook(String groupName, int timeout) throws Exception {
    PutLifecycleHookRequest request = new PutLifecycleHookRequest();
    request.setLifecycleHookName(String.format("LIFECYCLEHOOK-%s", groupName));
    request.setAutoScalingGroupName(groupName);
    request.setLifecycleTransition("autoscaling:EC2_INSTANCE_TERMINATING");
    request.setNotificationTargetARN(SNS_TOPIC_ARN);
    request.setRoleARN(ROLE_ARN);/* ww w .ja v  a 2s .  c  o  m*/
    request.setHeartbeatTimeout(timeout);
    // If reach the timeout limit, ABANDON all the actions to that instances and proceed to terminate it
    request.setDefaultResult(AutoScalingConstants.LIFECYCLE_ACTION_ABANDON);
    aasClient.putLifecycleHook(request);
}

From source file:com.pinterest.arcee.autoscaling.AwsAutoScalingManager.java

License:Apache License

@Override
public void createLifecycleHook(String groupName, int timeout) throws Exception {
    PutLifecycleHookRequest request = new PutLifecycleHookRequest();
    request.setLifecycleHookName(String.format("LIFECYCLEHOOK-%s", groupName));
    request.setAutoScalingGroupName(groupName);
    request.setLifecycleTransition("autoscaling:EC2_INSTANCE_TERMINATING");
    request.setNotificationTargetARN(snsArn);
    request.setRoleARN(roleARN);//from w  ww. ja  va2  s  . co  m
    request.setHeartbeatTimeout(timeout);
    // If reach the timeout limit, ABANDON all the actions to that instances and proceed to terminate it
    request.setDefaultResult(AutoScalingConstants.LIFECYCLE_ACTION_ABANDON);
    aasClient.putLifecycleHook(request);
}