Class CfnLifecycleHook
A CloudFormation AWS::AutoScaling::LifecycleHook
.
Inherited Members
Namespace: Amazon.CDK.AWS.AutoScaling
Assembly: Amazon.CDK.AWS.AutoScaling.dll
Syntax (csharp)
public class CfnLifecycleHook : CfnResource, IConstruct, IDependable, IInspectable
Syntax (vb)
Public Class CfnLifecycleHook
Inherits CfnResource
Implements IConstruct, IDependable, IInspectable
Remarks
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 .
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(Construct, String, ICfnLifecycleHookProps) | Create a new |
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 |
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. 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. |
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(Construct, String, ICfnLifecycleHookProps)
Create a new AWS::AutoScaling::LifecycleHook
.
public CfnLifecycleHook(Construct scope, string id, ICfnLifecycleHookProps props)
Parameters
- scope Construct
- scope in which this resource is defined.
- id System.String
- scoped id of the resource.
- props ICfnLifecycleHookProps
- resource properties.
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
Properties
AutoScalingGroupName
The name of the Auto Scaling group.
public virtual string AutoScalingGroupName { get; set; }
Property Value
System.String
Remarks
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
Remarks
The default value is ABANDON
.
Valid values: CONTINUE
| ABANDON
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>
Remarks
The range is from 30
to 7200
seconds. The default value is 3600
seconds (1 hour).
LifecycleHookName
The name of the lifecycle hook.
public virtual string LifecycleHookName { get; set; }
Property Value
System.String
Remarks
LifecycleTransition
The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.
public virtual string LifecycleTransition { get; set; }
Property Value
System.String
Remarks
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
Remarks
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
Remarks
You can specify an Amazon SNS topic or an Amazon SQS queue.
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
Remarks
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.
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>