AWS::CloudFormation::ResourceVersion
The AWS::CloudFormation::ResourceVersion
resource registers a resource
version with the CloudFormation registry. Registering a resource version makes it
available for use in CloudFormation templates in your AWS account,
and includes:
-
Validating the resource schema.
-
Determining which handlers, if any, have been specified for the resource.
-
Making the resource available for use in your account.
For information about the CloudFormation registry, see Managing extensions with the CloudFormation registry in the AWS CloudFormation User Guide.
You can have a maximum of 50 resource versions registered at a time. This maximum is per account and per Region.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::CloudFormation::ResourceVersion", "Properties" : { "ExecutionRoleArn" :
String
, "LoggingConfig" :LoggingConfig
, "SchemaHandlerPackage" :String
, "TypeName" :String
} }
YAML
Type: AWS::CloudFormation::ResourceVersion Properties: ExecutionRoleArn:
String
LoggingConfig:LoggingConfig
SchemaHandlerPackage:String
TypeName:String
Properties
ExecutionRoleArn
-
The Amazon Resource Name (ARN) of the IAM role for CloudFormation to assume when invoking the resource. If your resource calls AWS APIs in any of its handlers, you must create an IAM execution role that includes the necessary permissions to call those AWS APIs, and provision that execution role in your account. When CloudFormation needs to invoke the resource type handler, CloudFormation assumes this execution role to create a temporary session token, which it then passes to the resource type handler, thereby supplying your resource type with the appropriate credentials.
Required: No
Type: String
Pattern:
arn:.+:iam::[0-9]{12}:role/.+
Minimum:
1
Maximum:
256
Update requires: Replacement
LoggingConfig
-
Logging configuration information for a resource.
Required: No
Type: LoggingConfig
Update requires: Replacement
SchemaHandlerPackage
-
A URL to the S3 bucket containing the resource project package that contains the necessary files for the resource you want to register.
For information on generating a schema handler package, see Modeling resource types to use with AWS CloudFormation in the AWS CloudFormation Command Line Interface (CLI) User Guide.
Note
To register the resource version, you must have
s3:GetObject
permissions to access the S3 objects.Required: Yes
Type: String
Minimum:
1
Maximum:
4096
Update requires: Replacement
TypeName
-
The name of the resource being registered.
We recommend that resource names adhere to the following pattern: company_or_organization::service::type.
Note
The following organization namespaces are reserved and can't be used in your resource names:
-
Alexa
-
AMZN
-
Amazon
-
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 resource version. For example:
arn:aws:cloudformation:us-west-2:012345678901:type/resource/Sample-CloudFormation-Resource/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 resource.
IsDefaultVersion
-
Whether the specified resource version is set as the default version.
This applies only to private extensions you have registered in your account, and extensions published by AWS. For public third-party extensions, whether they are activated in your account, CloudFormation returns
null
. ProvisioningType
-
For resource type extensions, the provisioning behavior of the resource type. CloudFormation determines the provisioning type during registration, based on the types of handlers in the schema handler package submitted.
Valid values include:
-
FULLY_MUTABLE
: The resource type includes an update handler to process updates to the type during stack update operations. -
IMMUTABLE
: The resource type doesn't include an update handler, so the type can't be updated and must instead be replaced during stack update operations. -
NON_PROVISIONABLE
: The resource type doesn't include all the following handlers, and therefore can't actually be provisioned.-
create
-
read
-
delete
-
-
TypeArn
-
The Amazon Resource Name (ARN) for the extension.
VersionId
-
The ID of a specific version of the resource. The version ID is the value at the end of the Amazon Resource Name (ARN) assigned to the resource version when it is registered.
Visibility
-
The scope at which the resource is visible and usable in CloudFormation operations.
Valid values include:
-
PRIVATE
: The extension (resource) is only visible and usable within the account in which it is registered. CloudFormation marks any extensions you register asPRIVATE
. -
PUBLIC
: The extension (resource) is publicly visible and usable within any AWS account.
-
Examples
Specifying a resource version
The following example demonstrates how to specify a new resource version.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "ResourceVersion": { "Type": "AWS::CloudFormation::ResourceVersion", "Properties": { "TypeName": "My::Sample::Resource", "SchemaHandlerPackage": "s3://amzn-s3-demo-bucket/my-sample-resource.zip" } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: ResourceVersion: Type: AWS::CloudFormation::ResourceVersion Properties: TypeName: My::Sample::Resource SchemaHandlerPackage: s3://amzn-s3-demo-bucket/my-sample-resource.zip
Specifying a resource version and setting it as the default version
The following example demonstrates how to specify and new resource version, and
use the Ref
return value to set that version as the default
version.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "ResourceVersion": { "Type": "AWS::CloudFormation::ResourceVersion", "Properties": { "TypeName": "My::Sample::Resource", "SchemaHandlerPackage": "s3://amzn-s3-demo-bucket/my-sample-resource.zip" } }, "ResourceDefaultVersion": { "Type": "AWS::CloudFormation::ResourceDefaultVersion", "Properties": { "TypeVersionArn": { "Ref": "ResourceVersion" } } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: ResourceVersion: Type: AWS::CloudFormation::ResourceVersion Properties: TypeName: My::Sample::Resource SchemaHandlerPackage: s3://amzn-s3-demo-bucket/my-sample-resource.zip ResourceDefaultVersion: Type: AWS::CloudFormation::ResourceDefaultVersion Properties: TypeVersionArn: !Ref ResourceVersion