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

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

Introduction

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

Prototype


public void setNotificationTargetARN(String notificationTargetARN) 

Source Link

Document

The ARN of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for 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);//w w w  .java 2 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);
}

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);//w  w  w .ja  v a  2  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);
}