AWS CloudFormation Hooks development overview - AWS CloudFormation Hooks

AWS CloudFormation Hooks development overview

There are three major steps in developing a Hook:

  1. Initiate

    To initiate a Hook's project and its required files, use the CloudFormation CLI init command and specify that you want to create a Hook. For more information, see Initiating an AWS CloudFormation Hooks project.

  2. Model

    To model, author, and validate your Hook schema, define the Hook, its properties, and their attributes.

    The CloudFormation CLI creates empty handler functions which correspond to a specific Hook invocation point. Add your own logic to these handlers to control what happens during your Hook invocation at each stage of its target lifecycle. For more information, see Modeling AWS CloudFormation Hooks.

  3. Register

    To register a Hook, submit your Hook to be registered either as a private or a public third-party extension. Register your Hook with the submit operation. For more information, see Registering Hooks.

    The following tasks are associated with registering your Hook:

    1. Publish – Hooks are published to the registry.

    2. Configure – Hooks are configured when the type configuration invokes against stacks.

      There are two required type configuration properties:

      • TargetStacks is used to turn the Hook on or off.

        • TargetStacks set to ALL turns the Hook on for all stack operations.

        • TargetStacks set to NONE turns the Hook off, so it doesn't apply to stack operations.

      • FailureMode determines how CloudFormation responds to a failure response.

        • FailureMode set to FAIL prevents the operation.

        • FailureMode set to WARN allows the operation to continue and sends a warning.

    Note

    Hooks time out after 30 seconds.