Skip to main content

AWS DynamoDB

Type: state.aws.dynamodb

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-dynamodb/

Example

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: state.aws.dynamodb
version: v1
metadata:
# AWS access key associated with an IAM account
- name: accessKey
value: "AKIAIOSFODNN7EXAMPLE"
# The AWS Region where the AWS resource is deployed to.
- name: awsRegion
value: "us-east-1"
# The secret key associated with the access key
- name: secretKey
value: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
# AWS session token to use. A session token is only required if you are using temporary security credentials. (Optional)
#- name: sessionToken
# value: "TOKEN"
# The name of the DynamoDB table to use.
- name: table
value: "Contracts"
# Use this state store as the Workflows Store, it will enable the Workflows API. Defaults to `false`. (Optional)
#- name: enableWorkflow
# value: "false"
# AWS endpoint for the component to use. Only used for local development. The endpoint is not necessary when running against production AWS. (Optional)
#- name: endpoint
# value: "http://mycompany.com:4566"
# Prefix added to keys in the state store. (Optional)
#- name: keyPrefix
# value: "appid"
# By setting outboxDiscardWhenMissingState to true, Dapr discards the transaction if it cannot find the state in the database and does not retry. This setting can be useful if the state store data has been deleted for any reason before Dapr was able to deliver the message and you would like Dapr to drop the items from the pub/sub and stop retrying to fetch the state (Optional)
#- name: outboxDiscardWhenMissingState
# value: "false"
# For outbox. Sets the name of the pub/sub component to deliver the notifications when publishing state changes (Optional)
#- name: outboxPublishPubsub
# value: ""
# For outbox. Sets the topic that receives the state changes on the pub/sub configured with "outboxPublishPubsub". The message body will be a state transaction item for an insert or update operation (Optional)
#- name: outboxPublishTopic
# value: ""
# For outbox. Sets the pub/sub component used by Dapr to coordinate the state and pub/sub transactions. If not set, the pub/sub component configured with "outboxPublishPubsub" is used. This is useful if you want to separate the pub/sub component used to send the notification state changes from the one used to coordinate the transaction (Optional)
#- name: outboxPubsub
# value: "outboxPublishPubsub"
# The table primary key or partition key attribute name. This field is used to replace the default primary key attribute name "key". (Optional)
#- name: partitionKey
# value: "ContractID"
# The table attribute name which should be used for TTL. (Optional)
#- name: ttlAttributeName
# value: "expiresAt"

Authentication profiles

Available authentication profiles:

  • AWS: Access Key ID and Secret Access Key

AWS: Access Key ID and Secret Access Key

Authenticate using an Access Key ID and Secret Access Key included in the metadata

accessKey

Required - AWS access key associated with an IAM account

Example value: AKIAIOSFODNN7EXAMPLE

awsRegion (string)

Required - The AWS Region where the AWS resource is deployed to.

Example value: us-east-1

secretKey

Required - The secret key associated with the access key

Example value: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

sessionToken (string)

AWS session token to use. A session token is only required if you are using temporary security credentials.

Example value: TOKEN

Metadata

table (string)

Required - The name of the DynamoDB table to use.

Example value: Contracts

enableWorkflow (bool)

Use this state store as the Workflows Store, it will enable the Workflows API. Defaults to false.

Example value: false

endpoint (string)

AWS endpoint for the component to use. Only used for local development. The endpoint is not necessary when running against production AWS.

Example value: http://mycompany.com:4566

keyPrefix (string)

Prefix added to keys in the state store.

Default value: appid

Example value: appid

Allowed values:

  • appid

  • name

  • none

Documentation: https://docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state/

outboxDiscardWhenMissingState (bool)

By setting outboxDiscardWhenMissingState to true, Dapr discards the transaction if it cannot find the state in the database and does not retry. This setting can be useful if the state store data has been deleted for any reason before Dapr was able to deliver the message and you would like Dapr to drop the items from the pub/sub and stop retrying to fetch the state

Default value: false

outboxPublishPubsub (string)

For outbox. Sets the name of the pub/sub component to deliver the notifications when publishing state changes

outboxPublishTopic (string)

For outbox. Sets the topic that receives the state changes on the pub/sub configured with "outboxPublishPubsub". The message body will be a state transaction item for an insert or update operation

outboxPubsub (string)

For outbox. Sets the pub/sub component used by Dapr to coordinate the state and pub/sub transactions. If not set, the pub/sub component configured with "outboxPublishPubsub" is used. This is useful if you want to separate the pub/sub component used to send the notification state changes from the one used to coordinate the transaction

Default value: outboxPublishPubsub

partitionKey (string)

The table primary key or partition key attribute name. This field is used to replace the default primary key attribute name "key".

Example value: ContractID

More details: https://docs.dapr.io/reference/components-reference/supported-state-stores/setup-dynamodb/#partition-keys

ttlAttributeName (string)

The table attribute name which should be used for TTL.

Example value: expiresAt