@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:47.914Z") public class CfnLifecycleHook extends CfnResource implements IInspectable
The AWS::AutoScaling::LifecycleHook
resource specifies lifecycle hooks for an Auto Scaling group. These hooks let you create solutions that are aware of events in the Auto Scaling instance lifecycle, and then perform a custom action on instances when the corresponding lifecycle event occurs. A lifecycle hook provides a specified amount of time (one hour by default) to wait for the action to complete before the instance transitions to the next state.
Use lifecycle hooks to prepare new instances for use or to delay them from being registered behind a load balancer before their configuration has been applied completely. You can also use lifecycle hooks to prepare running instances to be terminated by, for example, downloading logs or other data.
For more information, see Amazon EC2 Auto Scaling lifecycle hooks in the Amazon EC2 Auto Scaling User Guide .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.autoscaling.*; CfnLifecycleHook cfnLifecycleHook = CfnLifecycleHook.Builder.create(this, "MyCfnLifecycleHook") .autoScalingGroupName("autoScalingGroupName") .lifecycleTransition("lifecycleTransition") // the properties below are optional .defaultResult("defaultResult") .heartbeatTimeout(123) .lifecycleHookName("lifecycleHookName") .notificationMetadata("notificationMetadata") .notificationTargetArn("notificationTargetArn") .roleArn("roleArn") .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnLifecycleHook.Builder
A fluent builder for
CfnLifecycleHook . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnLifecycleHook(Construct scope,
java.lang.String id,
CfnLifecycleHookProps props)
Create a new `AWS::AutoScaling::LifecycleHook`.
|
protected |
CfnLifecycleHook(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnLifecycleHook(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAutoScalingGroupName()
The name of the Auto Scaling group.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getDefaultResult()
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
|
java.lang.Number |
getHeartbeatTimeout()
The maximum time, in seconds, that can elapse before the lifecycle hook times out.
|
java.lang.String |
getLifecycleHookName()
The name of the lifecycle hook.
|
java.lang.String |
getLifecycleTransition()
The lifecycle transition.
|
java.lang.String |
getNotificationMetadata()
Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
|
java.lang.String |
getNotificationTargetArn()
The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook.
|
java.lang.String |
getRoleArn()
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAutoScalingGroupName(java.lang.String value)
The name of the Auto Scaling group.
|
void |
setDefaultResult(java.lang.String value)
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
|
void |
setHeartbeatTimeout(java.lang.Number value)
The maximum time, in seconds, that can elapse before the lifecycle hook times out.
|
void |
setLifecycleHookName(java.lang.String value)
The name of the lifecycle hook.
|
void |
setLifecycleTransition(java.lang.String value)
The lifecycle transition.
|
void |
setNotificationMetadata(java.lang.String value)
Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
|
void |
setNotificationTargetArn(java.lang.String value)
The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook.
|
void |
setRoleArn(java.lang.String value)
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnLifecycleHook(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnLifecycleHook(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnLifecycleHook(Construct scope, java.lang.String id, CfnLifecycleHookProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getAutoScalingGroupName()
public void setAutoScalingGroupName(java.lang.String value)
public java.lang.String getLifecycleTransition()
autoscaling:EC2_INSTANCE_LAUNCHING
.autoscaling:EC2_INSTANCE_TERMINATING
.public void setLifecycleTransition(java.lang.String value)
autoscaling:EC2_INSTANCE_LAUNCHING
.autoscaling:EC2_INSTANCE_TERMINATING
.public java.lang.String getDefaultResult()
The default value is ABANDON
.
Valid values: CONTINUE
| ABANDON
public void setDefaultResult(java.lang.String value)
The default value is ABANDON
.
Valid values: CONTINUE
| ABANDON
public java.lang.Number getHeartbeatTimeout()
The range is from 30
to 7200
seconds. The default value is 3600
seconds (1 hour).
public void setHeartbeatTimeout(java.lang.Number value)
The range is from 30
to 7200
seconds. The default value is 3600
seconds (1 hour).
public java.lang.String getLifecycleHookName()
public void setLifecycleHookName(java.lang.String value)
public java.lang.String getNotificationMetadata()
public void setNotificationMetadata(java.lang.String value)
public java.lang.String getNotificationTargetArn()
You can specify an Amazon SNS topic or an Amazon SQS queue.
public void setNotificationTargetArn(java.lang.String value)
You can specify an Amazon SNS topic or an Amazon SQS queue.
public java.lang.String getRoleArn()
For information about creating this role, see Configure a notification target for a lifecycle hook in the Amazon EC2 Auto Scaling User Guide .
Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.
public void setRoleArn(java.lang.String value)
For information about creating this role, see Configure a notification target for a lifecycle hook in the Amazon EC2 Auto Scaling User Guide .
Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.