KeyValueStore
The KeyValueStore resource lets you manage AWS CloudFront KeyValueStores for storing key-value pairs that can be used in your applications.
Minimal Example
Section titled “Minimal Example”Create a basic KeyValueStore with the required properties and a comment.
import AWS from "alchemy/aws/control";
const basicKeyValueStore = await AWS.CloudFront.KeyValueStore("basicKeyValueStore", { name: "primary-store", comment: "This is the primary KeyValueStore for my application."});
Advanced Configuration
Section titled “Advanced Configuration”Configure a KeyValueStore with an import source and adopt existing resources.
const advancedKeyValueStore = await AWS.CloudFront.KeyValueStore("advancedKeyValueStore", { name: "secondary-store", comment: "This KeyValueStore will import from an existing source.", importSource: { type: "existing", sourceId: "source-id-123" }, adopt: true});
Using with Existing Resources
Section titled “Using with Existing Resources”Adopt an existing KeyValueStore instead of creating a new one if it already exists.
const adoptedKeyValueStore = await AWS.CloudFront.KeyValueStore("adoptedKeyValueStore", { name: "existing-store", adopt: true});
Managing Resource Properties
Section titled “Managing Resource Properties”Access properties of the KeyValueStore such as ARN and timestamps.
const keyValueStore = await AWS.CloudFront.KeyValueStore("keyValueStore", { name: "my-key-value-store"});
// Log the ARN and timestampsconsole.log(`ARN: ${keyValueStore.Arn}`);console.log(`Creation Time: ${keyValueStore.CreationTime}`);console.log(`Last Update Time: ${keyValueStore.LastUpdateTime}`);