@Generated(value="jsii-pacmak/1.57.0 (build f614666)", date="2022-04-22T22:36:19.970Z") @Stability(value=Stable) 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. |
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnLifecycleHook(software.constructs.Construct scope,
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 |
|---|---|
String |
getAutoScalingGroupName()
The name of the Auto Scaling group for the lifecycle hook.
|
protected Map<String,Object> |
getCfnProperties() |
String |
getDefaultResult()
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
|
Number |
getHeartbeatTimeout()
The maximum time, in seconds, that can elapse before the lifecycle hook times out.
|
String |
getLifecycleHookName()
The name of the lifecycle hook.
|
String |
getLifecycleTransition()
The instance state to which you want to attach the lifecycle hook.
|
String |
getNotificationMetadata()
Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
|
String |
getNotificationTargetArn()
The Amazon Resource Name (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.
|
String |
getRoleArn()
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.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setAutoScalingGroupName(String value)
The name of the Auto Scaling group for the lifecycle hook.
|
void |
setDefaultResult(String value)
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
|
void |
setHeartbeatTimeout(Number value)
The maximum time, in seconds, that can elapse before the lifecycle hook times out.
|
void |
setLifecycleHookName(String value)
The name of the lifecycle hook.
|
void |
setLifecycleTransition(String value)
The instance state to which you want to attach the lifecycle hook.
|
void |
setNotificationMetadata(String value)
Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
|
void |
setNotificationTargetArn(String value)
The Amazon Resource Name (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.
|
void |
setRoleArn(String value)
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.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnLifecycleHook(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnLifecycleHook(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnLifecycleHook(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
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.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public String getAutoScalingGroupName()
@Stability(value=Stable)
public void setAutoScalingGroupName(@NotNull
String value)
@Stability(value=Stable) @NotNull public String getLifecycleTransition()
@Stability(value=Stable)
public void setLifecycleTransition(@NotNull
String value)
@Stability(value=Stable) @Nullable public String getDefaultResult()
The valid values are CONTINUE and ABANDON (default).
For more information, see Add lifecycle hooks in the Amazon EC2 Auto Scaling User Guide .
@Stability(value=Stable)
public void setDefaultResult(@Nullable
String value)
The valid values are CONTINUE and ABANDON (default).
For more information, see Add lifecycle hooks in the Amazon EC2 Auto Scaling User Guide .
@Stability(value=Stable) @Nullable public Number getHeartbeatTimeout()
The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour). If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult property.
@Stability(value=Stable)
public void setHeartbeatTimeout(@Nullable
Number value)
The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour). If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult property.
@Stability(value=Stable) @Nullable public String getLifecycleHookName()
@Stability(value=Stable)
public void setLifecycleHookName(@Nullable
String value)
@Stability(value=Stable) @Nullable public String getNotificationMetadata()
@Stability(value=Stable)
public void setNotificationMetadata(@Nullable
String value)
@Stability(value=Stable) @Nullable public String getNotificationTargetArn()
You can specify an Amazon SQS queue or an Amazon SNS topic. The notification message includes the following information: lifecycle action token, user account ID, Auto Scaling group name, lifecycle hook name, instance ID, lifecycle transition, and notification metadata.
@Stability(value=Stable)
public void setNotificationTargetArn(@Nullable
String value)
You can specify an Amazon SQS queue or an Amazon SNS topic. The notification message includes the following information: lifecycle action token, user account ID, Auto Scaling group name, lifecycle hook name, instance ID, lifecycle transition, and notification metadata.
@Stability(value=Stable) @Nullable public 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 .
@Stability(value=Stable)
public void setRoleArn(@Nullable
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 .
Copyright © 2022. All rights reserved.