DynamoDB Table
Learn how to create, configure, and manage AWS DynamoDB Tables using Alchemy for NoSQL database solutions.
The Table resource lets you create and manage Amazon DynamoDB tables for NoSQL database storage.
Minimal Example
Section titled “Minimal Example”Create a basic table with just a partition key:
import { Table } from "alchemy/aws";
const table = await Table("users", { tableName: "users", partitionKey: { name: "userId", type: "S", },});
Table with Sort Key
Section titled “Table with Sort Key”Add a sort key to enable range queries and composite keys:
const table = await Table("events", { tableName: "events", partitionKey: { name: "deviceId", type: "S", }, sortKey: { name: "timestamp", type: "N", },});
Provisioned Capacity
Section titled “Provisioned Capacity”Configure provisioned read/write capacity for predictable workloads:
const table = await Table("orders", { tableName: "orders", partitionKey: { name: "orderId", type: "S", }, billingMode: "PROVISIONED", readCapacity: 100, writeCapacity: 50, tags: { Environment: "production", },});