Skip to content
GitHubXDiscord

HookVersion

The HookVersion resource allows you to manage AWS CloudFormation HookVersions, which are used to define custom hooks that can be invoked during CloudFormation stack operations.

Create a basic HookVersion with required properties and one optional property.

import AWS from "alchemy/aws/control";
const basicHookVersion = await AWS.CloudFormation.HookVersion("basicHook", {
TypeName: "MyCustomHook",
SchemaHandlerPackage: "s3://my-bucket/my-custom-hook.zip",
ExecutionRoleArn: "arn:aws:iam::123456789012:role/MyHookExecutionRole"
});

Configure a HookVersion with logging configuration for better debugging and monitoring.

const advancedHookVersion = await AWS.CloudFormation.HookVersion("advancedHook", {
TypeName: "MyAdvancedCustomHook",
SchemaHandlerPackage: "s3://my-bucket/my-advanced-hook.zip",
ExecutionRoleArn: "arn:aws:iam::123456789012:role/MyAdvancedHookExecutionRole",
LoggingConfig: {
LogGroupName: "/aws/cloudformation/my-hooks",
LogRoleArn: "arn:aws:iam::123456789012:role/MyLoggingRole"
}
});

Create a HookVersion that adopts an existing resource instead of failing on creation.

const adoptExistingHookVersion = await AWS.CloudFormation.HookVersion("adoptHook", {
TypeName: "MyAdoptHook",
SchemaHandlerPackage: "s3://my-bucket/my-adopt-hook.zip",
ExecutionRoleArn: "arn:aws:iam::123456789012:role/MyAdoptHookExecutionRole",
adopt: true
});