Skip to content
GitHubXDiscordRSS

KeyValueStore

Learn how to create, update, and manage AWS CloudFront KeyValueStores using Alchemy Cloud Control.

The KeyValueStore resource lets you manage AWS CloudFront KeyValueStores for storing key-value pairs that can be used in your applications.

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."
});

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
});

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
});

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 timestamps
console.log(`ARN: ${keyValueStore.Arn}`);
console.log(`Creation Time: ${keyValueStore.CreationTime}`);
console.log(`Last Update Time: ${keyValueStore.LastUpdateTime}`);