This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.
AWS::CloudFront::KeyValueStore
The key value store. Use this to separate data from function code, allowing you to update data without having to publish a new version of a function. The key value store holds keys and their corresponding values.
Syntax
To declare this entity in your CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::CloudFront::KeyValueStore", "Properties" : { "Comment" :String, "ImportSource" :ImportSource, "Name" :String, "Tags" :[ Tag, ... ]} }
YAML
Type: AWS::CloudFront::KeyValueStore Properties: Comment:StringImportSource:ImportSourceName:StringTags:- Tag
Properties
Comment-
A comment to describe the Key Value Store. Omitting
Commentfrom the template during updates will clear the existing comment (set to empty string). To preserve an existing comment, you must explicitly include it in the template.Required: No
Type: String
Update requires: No interruption
ImportSource-
The import source for the key value store.
Required: No
Type: ImportSource
Update requires: Updates are not supported.
Name-
The name of the key value store.
Required: Yes
Type: String
Update requires: Replacement
-
A complex type that contains zero or more
Tagelements.Required: No
Type: Array of Tag
Update requires: No interruption
Return values
Ref
Fn::GetAtt
Arn-
The Amazon Resource Name (ARN) of the key value store.
Id-
The unique Id for the key value store.
Status-
The current status of the key value store. For more information, see Key value store statuses in the Amazon CloudFront Developer Guide.
Examples
Key value store
The following example creates a key value store named DemoKeyValueStore and a CloudFront function named DemoFunction.
JSON
{ "Resources": { "KeyValueStore": { "Type": "AWS::CloudFront::KeyValueStore", "Properties": {"Name": "DemoKeyValueStore"} }, "Function": { "Type": "AWS::CloudFront::Function", "Name": "DemoFunction", "FunctionConfig": { "Comment": "Function with KeyValueStore", "Runtime": "cloudfront-js-2.0", "KeyValueStoreAssociations": [ { "KeyValueStoreARN": {"Fn::Sub": "${KeyValueStore.Arn}"} } ] }, "FunctionCode": {"Fn::Sub": "const kvsId = '${KeyValueStore.Id}';\n// ... remaining function code ..."}, "AutoPublish": true } } }
YAML
Resources: KeyValueStore: Type: 'AWS::CloudFront::KeyValueStore' Properties: Name: 'DemoKeyValueStore' Function: Type: 'AWS::CloudFront::Function' Properties: Name: 'DemoFunction' FunctionConfig: Comment: 'Function with KeyValueStore' Runtime: 'cloudfront-js-2.0' KeyValueStoreAssociations: - KeyValueStoreARN: !Sub '${KeyValueStore.Arn}' FunctionCode: !Sub | const kvsId = '${KeyValueStore.Id}'; // ... Remaining function code ... AutoPublish: true