AWS::CloudFormation::ResourceDefaultVersion - AWS CloudFormation

AWS::CloudFormation::ResourceDefaultVersion

Specifies the default version of a resource. The default version of a resource will be used in CloudFormation operations.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::CloudFormation::ResourceDefaultVersion", "Properties" : { "TypeName" : String, "TypeVersionArn" : String, "VersionId" : String } }

YAML

Type: AWS::CloudFormation::ResourceDefaultVersion Properties: TypeName: String TypeVersionArn: String VersionId: String

Properties

TypeName

The name of the resource.

Conditional: You must specify either TypeVersionArn, or TypeName and VersionId.

Required: Conditional

Type: String

Pattern: ^[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}$

Update requires: No interruption

TypeVersionArn

The Amazon Resource Name (ARN) of the resource version.

Conditional: You must specify either TypeVersionArn, or TypeName and VersionId.

Required: Conditional

Type: String

Pattern: ^arn:aws[A-Za-z0-9-]{0,64}:cloudformation:[A-Za-z0-9-]{1,64}:([0-9]{12})?:type/resource/.+$

Update requires: No interruption

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's registered.

Conditional: You must specify either TypeVersionArn, or TypeName and VersionId.

Required: Conditional

Type: String

Pattern: ^[A-Za-z0-9-]{1,128}$

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ARN of the resource type. For example:

arn:aws:cloudformation:us-west-2:012345678910:type/resource/Sample-CloudFormation-Resource

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.

Examples

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://my-sample-resourceversion-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://my-sample-resourceversion-bucket/my-sample-resource.zip ResourceDefaultVersion: Type: AWS::CloudFormation::ResourceDefaultVersion Properties: TypeVersionArn: !Ref ResourceVersion