Developing AWS CloudFormation Hooks
There are three major steps in developing a Hook:
-
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. -
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.
-
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 private AWS CloudFormation Hooks.The following tasks are associated with registering your Hook:
-
Publish – Hooks are published to the registry.
-
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 toALL
turns the Hook on for all stack operations. -
TargetStacks
set toNONE
turns the Hook off, so it doesn't apply to stack operations.
-
-
FailureMode
determines how CloudFormation responds to a failure response.-
FailureMode
set toFAIL
prevents the operation. -
FailureMode
set toWARN
allows the operation to continue and sends a warning.
-
-
Note
Hooks time out after 30 seconds.
-
The topics in this chapter guide you through the process of developing, registering, and publishing your own Hooks with Python or Java.