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

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

Introduction

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

Prototype


public void setRoleARN(String roleARN) 

Source Link

Document

The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.

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);
    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);
    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);
}