Class CfnLifecycleHook
The AWS::AutoScaling::LifecycleHook
resource specifies lifecycle hooks for an Auto Scaling group.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.AutoScaling
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnLifecycleHook : CfnResource, IInspectable
Syntax (vb)
Public Class CfnLifecycleHook
Inherits CfnResource
Implements IInspectable
Remarks
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 .
CloudformationResource: AWS::AutoScaling::LifecycleHook
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AutoScaling;
var cfnLifecycleHook = new CfnLifecycleHook(this, "MyCfnLifecycleHook", new CfnLifecycleHookProps {
AutoScalingGroupName = "autoScalingGroupName",
LifecycleTransition = "lifecycleTransition",
// the properties below are optional
DefaultResult = "defaultResult",
HeartbeatTimeout = 123,
LifecycleHookName = "lifecycleHookName",
NotificationMetadata = "notificationMetadata",
NotificationTargetArn = "notificationTargetArn",
RoleArn = "roleArn"
});
Synopsis
Constructors
CfnLifecycleHook(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnLifecycleHook(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnLifecycleHook(Construct, String, ICfnLifecycleHookProps) |
Properties
AutoScalingGroupName | The name of the Auto Scaling group. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
DefaultResult | The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. |
HeartbeatTimeout | The maximum time, in seconds, that can elapse before the lifecycle hook times out. |
LifecycleHookName | The name of the lifecycle hook. |
LifecycleTransition | The lifecycle transition. |
NotificationMetadata | Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target. |
NotificationTargetArn | 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. |
RoleArn | The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnLifecycleHook(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnLifecycleHook(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnLifecycleHook(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnLifecycleHook(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnLifecycleHook(Construct, String, ICfnLifecycleHookProps)
public CfnLifecycleHook(Construct scope, string id, ICfnLifecycleHookProps props)
Parameters
- scope Constructs.Construct
Scope in which this resource is defined.
- id System.String
Construct identifier for this resource (unique in its scope).
- props ICfnLifecycleHookProps
Resource properties.
Properties
AutoScalingGroupName
The name of the Auto Scaling group.
public virtual string AutoScalingGroupName { get; set; }
Property Value
System.String
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
DefaultResult
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
public virtual string DefaultResult { get; set; }
Property Value
System.String
HeartbeatTimeout
The maximum time, in seconds, that can elapse before the lifecycle hook times out.
public virtual Nullable<double> HeartbeatTimeout { get; set; }
Property Value
System.Nullable<System.Double>
LifecycleHookName
The name of the lifecycle hook.
public virtual string LifecycleHookName { get; set; }
Property Value
System.String
LifecycleTransition
The lifecycle transition.
public virtual string LifecycleTransition { get; set; }
Property Value
System.String
Remarks
For Auto Scaling groups, there are two major lifecycle transitions.
NotificationMetadata
Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
public virtual string NotificationMetadata { get; set; }
Property Value
System.String
NotificationTargetArn
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.
public virtual string NotificationTargetArn { get; set; }
Property Value
System.String
RoleArn
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
public virtual string RoleArn { get; set; }
Property Value
System.String
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>