AWS::CloudFront::KeyValueStore - AWS CloudFormation

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 AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::CloudFront::KeyValueStore", "Properties" : { "Comment" : String, "ImportSource" : ImportSource, "Name" : String } }

YAML

Type: AWS::CloudFront::KeyValueStore Properties: Comment: String ImportSource: ImportSource Name: String

Properties

Comment

A comment for the key value store.

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

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