Skip to main content

lifecycle_hooks

Creates, updates, deletes or gets a lifecycle_hook resource or lists lifecycle_hooks in a region

Overview

Namelifecycle_hooks
TypeResource
DescriptionResource Type definition for AWS::AutoScaling::LifecycleHook
Idawscc.autoscaling.lifecycle_hooks

Fields

NameDatatypeDescription
auto_scaling_group_namestringThe name of the Auto Scaling group for the lifecycle hook.
default_resultstringThe action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The valid values are CONTINUE and ABANDON (default).
heartbeat_timeoutintegerThe maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour). If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the DefaultResult property.
lifecycle_hook_namestringThe name of the lifecycle hook.
lifecycle_transitionstringThe instance state to which you want to attach the lifecycle hook.
notification_metadatastringAdditional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
notification_target_arnstringThe Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in the transition state for the lifecycle hook. You can specify an Amazon SQS queue or an Amazon SNS topic. The notification message includes the following information: lifecycle action token, user account ID, Auto Scaling group name, lifecycle hook name, instance ID, lifecycle transition, and notification metadata.
role_arnstringThe ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target, for example, an Amazon SNS topic or an Amazon SQS queue.
regionstringAWS region.

For more information, see AWS::AutoScaling::LifecycleHook.

Methods

NameResourceAccessible byRequired Params
create_resourcelifecycle_hooksINSERTLifecycleTransition, AutoScalingGroupName, region
delete_resourcelifecycle_hooksDELETEIdentifier, region
update_resourcelifecycle_hooksUPDATEIdentifier, PatchDocument, region
list_resourceslifecycle_hooks_list_onlySELECTregion
get_resourcelifecycle_hooksSELECTIdentifier, region

SELECT examples

Gets all properties from an individual lifecycle_hook.

SELECT
region,
auto_scaling_group_name,
default_result,
heartbeat_timeout,
lifecycle_hook_name,
lifecycle_transition,
notification_metadata,
notification_target_arn,
role_arn
FROM awscc.autoscaling.lifecycle_hooks
WHERE
region = '{{ region }}' AND
Identifier = '{{ auto_scaling_group_name }}|{{ lifecycle_hook_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new lifecycle_hook resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.autoscaling.lifecycle_hooks (
AutoScalingGroupName,
LifecycleTransition,
region
)
SELECT
'{{ auto_scaling_group_name }}',
'{{ lifecycle_transition }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a lifecycle_hook resource, using stack-deploy.

/*+ update */
UPDATE awscc.autoscaling.lifecycle_hooks
SET PatchDocument = string('{{ {
"DefaultResult": default_result,
"HeartbeatTimeout": heartbeat_timeout,
"LifecycleTransition": lifecycle_transition,
"NotificationMetadata": notification_metadata,
"NotificationTargetARN": notification_target_arn,
"RoleARN": role_arn
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ auto_scaling_group_name }}|{{ lifecycle_hook_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.autoscaling.lifecycle_hooks
WHERE
Identifier = '{{ auto_scaling_group_name }}|{{ lifecycle_hook_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the lifecycle_hooks resource, the following permissions are required:

autoscaling:PutLifecycleHook,
autoscaling:DescribeLifecycleHooks,
iam:PassRole