From 462d607ad5fbbd1129c8f4acfc4ad87646272cf4 Mon Sep 17 00:00:00 2001 From: itowlson Date: Fri, 22 Nov 2024 13:31:06 +1300 Subject: [PATCH] AWS key-value store configuration Signed-off-by: itowlson --- content/spin/v3/dynamic-configuration.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/content/spin/v3/dynamic-configuration.md b/content/spin/v3/dynamic-configuration.md index 1632563ca..28cfa581d 100644 --- a/content/spin/v3/dynamic-configuration.md +++ b/content/spin/v3/dynamic-configuration.md @@ -15,6 +15,8 @@ url = "https://github.com/fermyon/developer/blob/main/content/spin/v3/dynamic-co - [Key Value Store Runtime Configuration](#key-value-store-runtime-configuration) - [Redis Key Value Store Provider](#redis-key-value-store-provider) - [Azure CosmosDB Key Value Store Provider](#azure-cosmosdb-key-value-store-provider) + - [AWS DynamoDB Key Value Store Provider](#aws-dynamodb-key-value-store-provider) + - [Multiple and Non-Default Key-Value Stores](#multiple-and-non-default-key-value-stores) - [SQLite Storage Runtime Configuration](#sqlite-storage-runtime-configuration) - [LibSQL Storage Provider](#libsql-storage-provider) - [LLM Runtime Configuration](#llm-runtime-configuration) @@ -247,7 +249,7 @@ url = "redis://localhost" ### Azure CosmosDB Key Value Store Provider -Similarly, to implement Azure CosmosDB as a backend for Spin's key/value store, change the type to `azure_cosmos` and specify your database account details: +To use an Azure CosmosDB database as a backend for Spin's key/value store, change the type to `azure_cosmos` and specify your database account details: ```toml [key_value_store.default] @@ -260,9 +262,25 @@ container = "" > Note: The CosmosDB container must be created with the default partition key, `/id`. -Whilst a single default store may be sufficient for certain application use cases, each Spin application can be configured to support multiple stores of any `type`, as shown in the `runtime-config.toml` file below: +### AWS DynamoDB Key Value Store Provider + +To use an Amazon Web Services DynamoDB database as a backend for Spin's key/value store, change the type to `aws_dynamo` and specify your database account details: + +```toml +[key_value_store.default] +type = "aws_dynamo" +region = "" # e.g. "us-east-1" +table = "" # e.g. "spin-key-values" +consistent_read = true # depending on your consistency requirement +``` + +You may optionally provide `access_key` and `secret_key` credentials; otherwise, Spin picks these up from your [AWS environment variables](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html). + +> Note: The DynamoDB table must be created with the primary key `PK`. It must have no secondary key. -> **Note:** At present, when deploying an application to Fermyon Cloud only the single "default" key-value store is supported. To see more about Spin support on Fermyon Cloud, visit the [limitations documentation](/cloud/faq#spin-limitations): +### Multiple and Non-Default Key-Value Stores + +Whilst a single default store may be sufficient for certain application use cases, each Spin application can be configured to support multiple stores of any `type`, as shown in the `runtime-config.toml` file below: ```toml # This defines a new store named user_data