Table of Contents

Class CfnLifecycleHook

Namespace
Amazon.CDK.AWS.AutoScaling
Assembly
Amazon.CDK.AWS.AutoScaling.dll

A CloudFormation AWS::AutoScaling::LifecycleHook.

public class CfnLifecycleHook : CfnResource, IInspectable
Inheritance
CfnLifecycleHook
Implements
IInspectable

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"
             });

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

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-lifecyclehook.html

ExampleMetadata: fixture=_generated

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 string
  • scoped id of the resource.
props ICfnLifecycleHookProps
  • resource properties.

Properties

AutoScalingGroupName

The name of the Auto Scaling group.

public virtual string AutoScalingGroupName { get; set; }

Property Value

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

string

CfnProperties

protected override IDictionary<string, object> CfnProperties { get; }

Property Value

IDictionary<string, object>

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

string

Remarks

HeartbeatTimeout

The maximum time, in seconds, that can elapse before the lifecycle hook times out.

public virtual double? HeartbeatTimeout { get; set; }

Property Value

double?

Remarks

LifecycleHookName

The name of the lifecycle hook.

public virtual string? LifecycleHookName { get; set; }

Property Value

string

Remarks

LifecycleTransition

The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.

public virtual string LifecycleTransition { get; set; }

Property Value

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

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

string

Remarks

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

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.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-lifecyclehook.html#cfn-autoscaling-lifecyclehook-rolearn

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 IDictionary<string, object>

Returns

IDictionary<string, object>