DynamoDB · Data

DynamoDBTable

Manage DynamoDB tables, keys, billing, indexes, and protection.

Generic driverUniform lifecycle
Scope
Regional
Spec fields
9
Outputs
4
Lookup
Supported

Resource definition

What this resource looks like

This is the CUE shape a Praxis template uses to declare a DynamoDBTable. The resource key is local to the template; metadata.name supplies its stable Praxis identity.

CUE example
resources: sessions: {
  apiVersion: "praxis.io/alpha"
  kind: "DynamoDBTable"
  metadata: {name: "payments-sessions", labels: {}}
  spec: {
    region: "us-west-2"
    billingMode: "PAY_PER_REQUEST"
    hashKey: "sessionId"
    hashKeyType: "S"
    tags: environment: "prod"
  }
}
Complete examples in the repository

Desired state

Configuration

The spec block accepts 9 fields. 3 are required by the schema; fields with defaults can be omitted.

regionRequired

Region.

string
String
billingModeOptional

Mutable — billing mode. PAY_PER_REQUEST (on-demand) or PROVISIONED. readCapacity/writeCapacity are only meaningful for PROVISIONED.

"PAY_PER_REQUEST" | "PROVISIONED" | *"PAY_PER_REQUEST"
EnumDefault "PAY_PER_REQUEST"
hashKeyRequired

Immutable after creation — the primary key schema. Changing any of these surfaces as an informational, requires-replacement diff.

string
String
hashKeyTypeOptional

Hash Key Type.

"S" | "N" | "B" | *"S"
EnumDefault "S"
rangeKeyOptional

Range Key.

string
String
rangeKeyTypeOptional

Range Key Type.

"S" | "N" | "B" | *"S"
EnumDefault "S"
readCapacityOptional

Mutable — provisioned throughput. Only applied when billingMode is PROVISIONED; ignored for PAY_PER_REQUEST.

int & >=1 | *5
IntegerDefault 5
writeCapacityOptional

Write Capacity.

int & >=1 | *5
IntegerDefault 5
tagsRequired

Tags.

[string]: string
Map

Observed values

Outputs

Praxis records these values after observation. A dependent resource can read one with ${resources.<name>.outputs.<field>}.

arnString
nameString
statusString
itemCountInteger · optional

Read without ownership

Data-source lookup

A data block reads an existing DynamoDBTable and exposes its outputs without storing lifecycle state. The generic filter surface accepts id, name, and tag; supported combinations depend on the AWS identity used by this resource.

CUE data source
data: existing: {
  kind: "DynamoDBTable"
  region: "us-west-2"
  filter: {
    name: "replace-with-provider-name"
  }
}
Documented selectorsidnameid/name + tag

Understand data sources and filters →

Adopt existing infrastructure

Import

Import persists Praxis state for an existing AWS resource. For this kind, supply: Table name and region. The example starts in observed mode so Praxis reports drift without correcting it.

CLI
praxis import DynamoDBTable \
  --id <provider-identifier> \
  --region us-west-2 \
  --account production \
  --observe

Choose managed or observed ownership →

Canonical contract

Complete CUE schema

The field guide above is derived from this definition. The schema remains the source of truth for accepted values, defaults, validation constraints, and outputs in the current alpha revision.

Show the complete schema
schemas/aws/dynamodb/table.cue
package dynamodb

#DynamoDBTable: {
	apiVersion: "praxis.io/alpha"
	kind:       "DynamoDBTable"

	metadata: {
		// Table names are 3-255 chars: letters, digits, underscores, hyphens, dots.
		name: string & =~"^[a-zA-Z0-9_.\\-]{3,255}$"
		labels: [string]: string
	}

	spec: {
		region: string

		// Mutable — billing mode. PAY_PER_REQUEST (on-demand) or PROVISIONED.
		// readCapacity/writeCapacity are only meaningful for PROVISIONED.
		billingMode: "PAY_PER_REQUEST" | "PROVISIONED" | *"PAY_PER_REQUEST"

		// Immutable after creation — the primary key schema. Changing any of
		// these surfaces as an informational, requires-replacement diff.
		hashKey:      string
		hashKeyType:  "S" | "N" | "B" | *"S"
		rangeKey?:    string
		rangeKeyType: "S" | "N" | "B" | *"S"

		// Mutable — provisioned throughput. Only applied when billingMode is
		// PROVISIONED; ignored for PAY_PER_REQUEST.
		readCapacity:  int & >=1 | *5
		writeCapacity: int & >=1 | *5

		tags: [string]: string
	}

	outputs?: {
		arn:        string
		name:       string
		status:     string
		itemCount?: int
	}
}

View this schema on GitHub →