AWS DynamoDB
To setup a DynamoDB state store create a component of type . See on how to create and apply a state store configuration.
Warning
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described .
Primary Key
In order to use DynamoDB as a Dapr state store, the table must have a primary key named key
. See the section for an option to change this behavior.
Important
Setup AWS DynamoDB
See for information about authentication-related attributes
In order to use DynamoDB TTL feature, you must enable TTL on your table and define the attribute name. The attribute name must be defined in the ttlAttributeName
field. See official .
Partition Keys
By default, the DynamoDB state store component uses the table attribute name key
as primary/partition key in the DynamoDB table. This can be overridden by specifying a metadata field in the component configuration with a key of and a value of the desired attribute name.
The following statestore.yaml
file shows how to configure the DynamoDB state store component to use the partition key attribute name of ContractID
:
The above component specification assumes the following DynamoDB Table Layout:
The following operation passes "A12345"
as the value for key
, and based on the component specification provided above, the Dapr runtime will replace the key
attribute name with ContractID
as the Partition/Primary Key sent to DynamoDB:
- Basic schema for a Dapr component
- Read for instructions on configuring state store components
- Authenticating to AWS