Key/Value Stores

1. System Context

Developers use Nitric to define required key/value stores within their application.

  • App code uses the Key/Value resource from the Nitric SDK.
  • Developers define key/value stores their application requires and implement logic to securely read/write/delete values with unique keys.

Operations use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.

Example AWS Provider
  • AWS DynamoDB serves as the key/value store backend.
  • AWS IAM provides roles and policies for secure access to DynamoDB tables.
Code
Terraform
Create DynamoDB
Store/Retrieve Data
Provide Access
Developer
Operations
nitric up
AWS DynamoDB
(Key/Value Store)
AWS Lambda Functions
AWS IAM
Example GCP Provider
  • Google Firestore serves as the key/value store backend.
  • Google IAM provides roles and policies for secure access to Firestore.
Code
Terraform
Create Firestore
Store/Retrieve Data
Provide Access
Developer
Operations
nitric up
Google Firestore
(Key/Value Store)
Google Cloud Functions
Google IAM

2. Sequence

ClientNitric SDKNitric RuntimeDynamoDBalt[Successful Operation][Failure]Request to set/get/delete a key-valueForward API call with key, value, or operationPerform operation (GetItem, PutItem, DeleteItem, Scan)Return result (e.g., value, success status)Return resultReturn result to clientReturn error (e.g., AccessDenied, NotFound)Forward errorReturn error responseClientNitric SDKNitric RuntimeDynamoDB

3. Component

Key/Value Store Module

  • Ensures unique identification of key-value stores by using a standardized naming convention or randomly generated identifiers.
  • Supports the definition of attributes, partition keys, and optional sort keys to optimize data organization and querying.
  • Provides scalable and cost-efficient storage configurations suitable for variable workloads.
  • Enables dynamic access control by assigning permissions to applications or services based on predefined roles and policies, ensuring least privilege access.
  • Offers support for event-driven workflows, allowing integration with notification systems or functions triggered by changes in the store.
  • Abstracts the underlying key-value storage implementation, enabling consistent developer and operations experience across different cloud providers.

4. Code

Developers write application code that uses the Key/Value resource from the SDK, configures the secret, and implements the application logic to access and manage secrets.

SDK Reference by language -

Operations will use or extend the Nitric Terraform reference modules:

Last updated on Feb 4, 2025