Class CfnLifecycleHook
- All Implemented Interfaces:
IInspectable,ILifecycleHookRef,IEnvironmentAware,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
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();
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.autoscaling.ILifecycleHookRef
ILifecycleHookRef.Jsii$Default, ILifecycleHookRef.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnLifecycleHook(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnLifecycleHook(software.amazon.jsii.JsiiObjectRef objRef) CfnLifecycleHook(software.constructs.Construct scope, String id, CfnLifecycleHookProps props) Create a newAWS::AutoScaling::LifecycleHook. -
Method Summary
Modifier and TypeMethodDescriptionThe name of the Auto Scaling group.The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.The maximum time, in seconds, that can elapse before the lifecycle hook times out.The name of the lifecycle hook.A reference to a LifecycleHook resource.The lifecycle transition.Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.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.The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetAutoScalingGroupName(String value) The name of the Auto Scaling group.voidsetDefaultResult(String value) The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.voidsetHeartbeatTimeout(Number value) The maximum time, in seconds, that can elapse before the lifecycle hook times out.voidsetLifecycleHookName(String value) The name of the lifecycle hook.voidsetLifecycleTransition(String value) The lifecycle transition.voidsetNotificationMetadata(String value) Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.voidsetNotificationTargetArn(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.voidsetRoleArn(String value) The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnLifecycleHook
protected CfnLifecycleHook(software.amazon.jsii.JsiiObjectRef objRef) -
CfnLifecycleHook
protected CfnLifecycleHook(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnLifecycleHook
@Stability(Stable) public CfnLifecycleHook(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnLifecycleHookProps props) Create a newAWS::AutoScaling::LifecycleHook.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getLifecycleHookRef
A reference to a LifecycleHook resource.- Specified by:
getLifecycleHookRefin interfaceILifecycleHookRef
-
getAutoScalingGroupName
The name of the Auto Scaling group. -
setAutoScalingGroupName
The name of the Auto Scaling group. -
getLifecycleTransition
The lifecycle transition.For Auto Scaling groups, there are two major lifecycle transitions.
-
setLifecycleTransition
The lifecycle transition.For Auto Scaling groups, there are two major lifecycle transitions.
-
getDefaultResult
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. -
setDefaultResult
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. -
getHeartbeatTimeout
The maximum time, in seconds, that can elapse before the lifecycle hook times out. -
setHeartbeatTimeout
The maximum time, in seconds, that can elapse before the lifecycle hook times out. -
getLifecycleHookName
The name of the lifecycle hook. -
setLifecycleHookName
The name of the lifecycle hook. -
getNotificationMetadata
Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target. -
setNotificationMetadata
Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target. -
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. -
setNotificationTargetArn
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. -
getRoleArn
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. -
setRoleArn
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
-