Class LifecycleHook
- All Implemented Interfaces:
Serializable
,Cloneable
Describes a lifecycle hook, which tells Auto Scaling that you want to perform an action when an instance launches or terminates. When you have a lifecycle hook in place, the Auto Scaling group will either:
- Pause the instance after it launches, but before it is put into service
- Pause the instance as it terminates, but before it is fully terminated
For more information, see Auto Scaling Lifecycle in the Auto Scaling Developer Guide.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
The name of the Auto Scaling group for the lifecycle hook.Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs.The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state.The maximum time, in seconds, that can elapse before the lifecycle hook times out.The name of the lifecycle hook.The state of the EC2 instance to which you want to attach the lifecycle hook.Additional information that you want to include any time Auto Scaling sends a message to the notification target.The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook.The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.int
hashCode()
void
setAutoScalingGroupName
(String autoScalingGroupName) The name of the Auto Scaling group for the lifecycle hook.void
setDefaultResult
(String defaultResult) Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs.void
setGlobalTimeout
(Integer globalTimeout) The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state.void
setHeartbeatTimeout
(Integer heartbeatTimeout) The maximum time, in seconds, that can elapse before the lifecycle hook times out.void
setLifecycleHookName
(String lifecycleHookName) The name of the lifecycle hook.void
setLifecycleTransition
(String lifecycleTransition) The state of the EC2 instance to which you want to attach the lifecycle hook.void
setNotificationMetadata
(String notificationMetadata) Additional information that you want to include any time Auto Scaling sends a message to the notification target.void
setNotificationTargetARN
(String notificationTargetARN) The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook.void
setRoleARN
(String roleARN) The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.toString()
Returns a string representation of this object; useful for testing and debugging.withAutoScalingGroupName
(String autoScalingGroupName) The name of the Auto Scaling group for the lifecycle hook.withDefaultResult
(String defaultResult) Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs.withGlobalTimeout
(Integer globalTimeout) The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state.withHeartbeatTimeout
(Integer heartbeatTimeout) The maximum time, in seconds, that can elapse before the lifecycle hook times out.withLifecycleHookName
(String lifecycleHookName) The name of the lifecycle hook.withLifecycleTransition
(String lifecycleTransition) The state of the EC2 instance to which you want to attach the lifecycle hook.withNotificationMetadata
(String notificationMetadata) Additional information that you want to include any time Auto Scaling sends a message to the notification target.withNotificationTargetARN
(String notificationTargetARN) The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook.withRoleARN
(String roleARN) The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
-
Constructor Details
-
LifecycleHook
public LifecycleHook()
-
-
Method Details
-
setLifecycleHookName
The name of the lifecycle hook.
- Parameters:
lifecycleHookName
- The name of the lifecycle hook.
-
getLifecycleHookName
The name of the lifecycle hook.
- Returns:
- The name of the lifecycle hook.
-
withLifecycleHookName
The name of the lifecycle hook.
- Parameters:
lifecycleHookName
- The name of the lifecycle hook.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setAutoScalingGroupName
The name of the Auto Scaling group for the lifecycle hook.
- Parameters:
autoScalingGroupName
- The name of the Auto Scaling group for the lifecycle hook.
-
getAutoScalingGroupName
The name of the Auto Scaling group for the lifecycle hook.
- Returns:
- The name of the Auto Scaling group for the lifecycle hook.
-
withAutoScalingGroupName
The name of the Auto Scaling group for the lifecycle hook.
- Parameters:
autoScalingGroupName
- The name of the Auto Scaling group for the lifecycle hook.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setLifecycleTransition
The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
- Parameters:
lifecycleTransition
- The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
-
getLifecycleTransition
The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
- Returns:
- The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
-
withLifecycleTransition
The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.
- Parameters:
lifecycleTransition
- The state of the EC2 instance to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setNotificationTargetARN
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Parameters:
notificationTargetARN
- The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
-
getNotificationTargetARN
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Returns:
- The ARN of the notification target that Auto Scaling uses to
notify you when an instance is in the transition state for the
lifecycle hook. This ARN target can be either an SQS queue or an
SNS topic. The notification message sent to the target includes
the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
-
withNotificationTargetARN
The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:
- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Parameters:
notificationTargetARN
- The ARN of the notification target that Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. The notification message sent to the target includes the following:- Lifecycle action token
- User account ID
- Name of the Auto Scaling group
- Lifecycle hook name
- EC2 instance ID
- Lifecycle transition
- Notification metadata
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setRoleARN
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
- Parameters:
roleARN
- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
-
getRoleARN
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
- Returns:
- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
-
withRoleARN
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
- Parameters:
roleARN
- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setNotificationMetadata
Additional information that you want to include any time Auto Scaling sends a message to the notification target.
- Parameters:
notificationMetadata
- Additional information that you want to include any time Auto Scaling sends a message to the notification target.
-
getNotificationMetadata
Additional information that you want to include any time Auto Scaling sends a message to the notification target.
- Returns:
- Additional information that you want to include any time Auto Scaling sends a message to the notification target.
-
withNotificationMetadata
Additional information that you want to include any time Auto Scaling sends a message to the notification target.
- Parameters:
notificationMetadata
- Additional information that you want to include any time Auto Scaling sends a message to the notification target.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setHeartbeatTimeout
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
- Parameters:
heartbeatTimeout
- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
-
getHeartbeatTimeout
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
- Returns:
- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
-
withHeartbeatTimeout
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.
- Parameters:
heartbeatTimeout
- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The default is 3600 seconds (1 hour). When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setGlobalTimeout
The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Parameters:
globalTimeout
- The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).
-
getGlobalTimeout
The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Returns:
- The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).
-
withGlobalTimeout
The maximum time, in seconds, that an instance can remain in a
Pending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Parameters:
globalTimeout
- The maximum time, in seconds, that an instance can remain in aPending:Wait
orTerminating:Wait
state. The default is 172800 seconds (48 hours).- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setDefaultResult
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.- Parameters:
defaultResult
- Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values areCONTINUE
andABANDON
. The default value isCONTINUE
.
-
getDefaultResult
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.- Returns:
- Defines the action the Auto Scaling group should take when the
lifecycle hook timeout elapses or if an unexpected failure
occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.
-
withDefaultResult
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are
CONTINUE
andABANDON
. The default value isCONTINUE
.- Parameters:
defaultResult
- Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values areCONTINUE
andABANDON
. The default value isCONTINUE
.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
toString
Returns a string representation of this object; useful for testing and debugging. -
equals
-
hashCode
public int hashCode() -
clone
-