LifecycleHookProps
Struct Stable
Properties for a Lifecycle hook.
| Source | aws-autoscaling/lib/lifecycle-hook.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_autoscaling as interfaces_autoscaling } from 'aws-cdk-lib/interfaces';
declare const autoScalingGroupRef: interfaces_autoscaling.IAutoScalingGroupRef;
declare const lifecycleHookTarget: autoscaling.ILifecycleHookTarget;
declare const role: iam.Role;
const lifecycleHookProps: autoscaling.LifecycleHookProps = {
autoScalingGroup: autoScalingGroupRef,
lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_LAUNCHING,
// the properties below are optional
defaultResult: autoscaling.DefaultResult.CONTINUE,
heartbeatTimeout: cdk.Duration.minutes(30),
lifecycleHookName: 'lifecycleHookName',
notificationMetadata: 'notificationMetadata',
notificationTarget: lifecycleHookTarget,
role: role,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_autoscaling as autoscaling
from aws_cdk import aws_iam as iam
from aws_cdk.interfaces import aws_autoscaling as interfaces_autoscaling
# auto_scaling_group_ref: interfaces_autoscaling.IAutoScalingGroupRef
# lifecycle_hook_target: autoscaling.ILifecycleHookTarget
# role: iam.Role
lifecycle_hook_props = autoscaling.LifecycleHookProps(
auto_scaling_group=auto_scaling_group_ref,
lifecycle_transition=autoscaling.LifecycleTransition.INSTANCE_LAUNCHING,
# the properties below are optional
default_result=autoscaling.DefaultResult.CONTINUE,
heartbeat_timeout=cdk.Duration.minutes(30),
lifecycle_hook_name="lifecycleHookName",
notification_metadata="notificationMetadata",
notification_target=lifecycle_hook_target,
role=role
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.autoscaling.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.interfaces.autoscaling.*;
IAutoScalingGroupRef autoScalingGroupRef;
ILifecycleHookTarget lifecycleHookTarget;
Role role;
LifecycleHookProps lifecycleHookProps = LifecycleHookProps.builder()
.autoScalingGroup(autoScalingGroupRef)
.lifecycleTransition(LifecycleTransition.INSTANCE_LAUNCHING)
// the properties below are optional
.defaultResult(DefaultResult.CONTINUE)
.heartbeatTimeout(Duration.minutes(30))
.lifecycleHookName("lifecycleHookName")
.notificationMetadata("notificationMetadata")
.notificationTarget(lifecycleHookTarget)
.role(role)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.AutoScaling;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.Interfaces.AutoScaling;
IAutoScalingGroupRef autoScalingGroupRef;
ILifecycleHookTarget lifecycleHookTarget;
Role role;
var lifecycleHookProps = new LifecycleHookProps {
AutoScalingGroup = autoScalingGroupRef,
LifecycleTransition = LifecycleTransition.INSTANCE_LAUNCHING,
// the properties below are optional
DefaultResult = DefaultResult.CONTINUE,
HeartbeatTimeout = Duration.Minutes(30),
LifecycleHookName = "lifecycleHookName",
NotificationMetadata = "notificationMetadata",
NotificationTarget = lifecycleHookTarget,
Role = role
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var autoScalingGroupRef IAutoScalingGroupRef
var lifecycleHookTarget ILifecycleHookTarget
var role Role
lifecycleHookProps := &LifecycleHookProps{
AutoScalingGroup: autoScalingGroupRef,
LifecycleTransition: awscdk.Aws_autoscaling.LifecycleTransition_INSTANCE_LAUNCHING,
// the properties below are optional
DefaultResult: awscdk.*Aws_autoscaling.DefaultResult_CONTINUE,
HeartbeatTimeout: cdk.Duration_Minutes(jsii.Number(30)),
LifecycleHookName: jsii.String("lifecycleHookName"),
NotificationMetadata: jsii.String("notificationMetadata"),
NotificationTarget: lifecycleHookTarget,
Role: role,
}
Properties
autoScalingGroupIAutoScalingGroupRefauto_scaling_groupIAutoScalingGroupRefautoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRef required #The AutoScalingGroup to add the lifecycle hook to.
defaultResultoptionalDefaultResultdefault_resultoptionalDefaultResultdefaultResultoptionalDefaultResultDefaultResultoptionalDefaultResultDefaultResultoptionalDefaultResult = Continue #The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
heartbeatTimeoutoptionalDurationheartbeat_timeoutoptionalDurationheartbeatTimeoutoptionalDurationHeartbeatTimeoutoptionalDurationHeartbeatTimeoutoptionalDuration #Maximum time between calls to RecordLifecycleActionHeartbeat for the hook.
Default: No heartbeat timeout.
If the lifecycle hook times out, perform the action in DefaultResult.
lifecycleHookNameoptionalstringlifecycle_hook_nameoptionalstrlifecycleHookNameoptionalStringLifecycleHookNameoptionalstringLifecycleHookNameoptional*string #Name of the lifecycle hook.
Default: Automatically generated name.
lifecycleTransitionLifecycleTransitionlifecycle_transitionLifecycleTransitionlifecycleTransitionLifecycleTransitionLifecycleTransitionLifecycleTransitionLifecycleTransitionLifecycleTransition required #The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.
notificationMetadataoptionalstringnotification_metadataoptionalstrnotificationMetadataoptionalStringNotificationMetadataoptionalstringNotificationMetadataoptional*string #Additional data to pass to the lifecycle hook target.
Default: No metadata.
notificationTargetoptionalILifecycleHookTargetnotification_targetoptionalILifecycleHookTargetnotificationTargetoptionalILifecycleHookTargetNotificationTargetoptionalILifecycleHookTargetNotificationTargetoptionalILifecycleHookTarget #The target of the lifecycle hook.
Default: No target.