Managing Hooks - AWS CloudFormation Hooks

Managing Hooks

Once you've registered a Hook, you can manage it through the CloudFormation registry, including versioning, account, and region availability.

Updating a Hook

Updating a Hook allows revisions in the Hook to be made available in the CloudFormation registry.

To update a Hook, submit your revisions to the CloudFormation registry through the CloudFormation CLI submit operation.

$ cfn submit

To specify the default version of your Hook in your account, use the set-type-default-version command and specify the type, type name, and version ID.

$ aws cloudformation set-type-default-version \ --type HOOK \ --type-name MyCompany::Testing::MyTestHook \ --version-id 00000003

To retrieve information about the versions of a Hook, use list-type-versions.

$ aws cloudformation list-type-versions \ --type HOOK \ --type-name "MyCompany::Testing::MyTestHook"

Deactivating a Hook

Deactivating a Hook prevents the Hook from running your AWS account.

TargetStacks set to NONE turns the Hook off in your account, so it doesn't apply to stack operations. Use the set-type-configuration operation and specify TargetStacks as NONE to deactivate a Hook.

The following example specifies the AWS Region and the Amazon Resource Name (ARN) of the Hook that's being deactivated.

$ aws cloudformation set-type-configuration \ --region us-west-2 \ --configuration '{"CloudFormationConfiguration": {"HookConfiguration": {"TargetStacks": "NONE", "FailureMode": "FAIL", "Properties":{}}}}' \ --type-arn HOOK_TYPE_ARN

Deregistering a Hook

Deregistering a Hook marks the extension or extension version as DEPRECATED in the CloudFormation registry, which removes it from active use. Once deprecated, the Hook can't be used in a CloudFormation operation.

Note

Before deregistering the Hook, you must individually deregister all previous active versions of that extension. For more information, see DeregisterType.

To deregister a Hook, use the deregister-type operation and specify your Hook ARN.

$ aws cloudformation deregister-type \ --arn HOOK_TYPE_ARN

This command doesn't produce an output.