AWS::CloudFormation::HookVersion
The AWS::CloudFormation::HookVersion
resource publishes new or first
version of a Hook to the CloudFormation registry.
For information about the CloudFormation registry, see Managing extensions with the CloudFormation registry in the AWS CloudFormation User Guide.
This resource type is not compatible with Guard and Lambda Hooks.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::CloudFormation::HookVersion", "Properties" : { "ExecutionRoleArn" :
String
, "LoggingConfig" :LoggingConfig
, "SchemaHandlerPackage" :String
, "TypeName" :String
} }
YAML
Type: AWS::CloudFormation::HookVersion Properties: ExecutionRoleArn:
String
LoggingConfig:LoggingConfig
SchemaHandlerPackage:String
TypeName:String
Properties
ExecutionRoleArn
-
The Amazon Resource Name (ARN) of the task execution role that grants the Hook permission.
Required: No
Type: String
Pattern:
arn:.+:iam::[0-9]{12}:role/.+
Maximum:
256
Update requires: Replacement
LoggingConfig
-
Contains logging configuration information for an extension.
Required: No
Type: LoggingConfig
Update requires: Replacement
SchemaHandlerPackage
-
A URL to the Amazon S3 bucket containing the Hook project package that contains the necessary files for the Hook you want to register.
For information on generating a schema handler package, see Modeling custom CloudFormation Hooks in the AWS CloudFormation Hooks User Guide.
Note
To register the Hook, you must have
s3:GetObject
permissions to access the S3 objects.Required: Yes
Type: String
Maximum:
4096
Update requires: Replacement
TypeName
-
The unique name for your hook. Specifies a three-part namespace for your hook, with a recommended pattern of
Organization::Service::Hook
.Note
The following organization namespaces are reserved and can't be used in your hook type names:
-
Alexa
-
AMZN
-
Amazon
-
ASK
-
AWS
-
Custom
-
Dev
Required: Yes
Type: String
Pattern:
^[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}$
Update requires: Replacement
-
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the ARN of the Hook version. For example:
arn:aws:cloudformation:us-west-2:012345678901:type/hook/Sample-CloudFormation-Hook/00000001
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
The Fn::GetAtt
intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function, see Fn::GetAtt
.
Arn
-
The Amazon Resource Name (ARN) of the Hook.
IsDefaultVersion
-
Whether the specified Hook version is set as the default version.
TypeArn
-
The Amazon Resource Number (ARN) assigned to this version of the Hook.
VersionId
-
The ID of this version of the Hook.
Visibility
-
The scope at which the Hook is visible and usable in CloudFormation operations.
Valid values include:
-
PRIVATE
: The extension (Hook) is only visible and usable within the account in which it's registered. CloudFormation marks any resources you register asPRIVATE
. -
PUBLIC
: The extension (Hook) is publicly visible and usable within any AWS account.
-
Examples
Specifying a Hook version
The following example demonstrates how to specify a new Hook version.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "HookVersion": { "Type": "AWS::CloudFormation::HookVersion", "Properties": { "TypeName": "My::Sample::Hook", "SchemaHandlerPackage": "s3://amzn-s3-demo-bucket/my-sample-hook.zip" } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: HookVersion: Type: 'AWS::CloudFormation::HookVersion' Properties: TypeName: 'My::Sample::Hook' SchemaHandlerPackage: 's3://amzn-s3-demo-bucket/my-sample-hook.zip'
Specifying the default Hook version
The following example demonstrates how to specify a new Hook version and use the
Ref
return value to set that version as the default version.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "HookVersion": { "Type": "AWS::CloudFormation::HookVersion", "Properties": { "TypeName": "My::Sample::Hook", "SchemaHandlerPackage": "s3://amzn-s3-demo-bucket/my-sample-hook.zip" } }, "HookDefaultVersion": { "Type": "AWS::CloudFormation::HookDefaultVersion", "Properties": { "TypeVersionArn": { "Ref": "HookVersion" } } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: HookVersion: Type: AWS::CloudFormation::HookVersion Properties: TypeName: My::Sample::Hook SchemaHandlerPackage: s3://amzn-s3-demo-bucket/my-sample-hook.zip HookDefaultVersion: Type: AWS::CloudFormation::HookDefaultVersion Properties: TypeVersionArn: !Ref HookVersion