DynamoDB persistence layer for idempotency records.

This class uses the AWS SDK for JavaScript v3 to write and read idempotency records from DynamoDB.

There are various options to configure the persistence layer, such as the table name, the key attribute, the status attribute, etc.

With default configuration you don't need to create the client beforehand, the persistence layer will create it for you. You can also bring your own AWS SDK V3 client, or configure the client with the clientConfig option.

See the Idempotency documentation for more details on the IAM permissions and DynamoDB table configuration.

Example

import { DynamoDBPersistenceLayer } from '@aws-lambda-powertools/idempotency/dynamodb';

const persistence = new DynamoDBPersistenceLayer({
tableName: 'my-idempotency-table',
});

See

https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/index.html

Implements

Hierarchy (view full)

Constructors

Properties

idempotencyKeyPrefix: string

Methods

  • Saves a record indicating that the function's execution is currently in progress

    Parameters

    • data: JSONValue

      the data payload that will be hashed to create the hash portion of the idempotency key

    • Optional remainingTimeInMillis: number

      the remaining time left in the lambda execution context

    Returns Promise<void>

  • Saves a record of the function completing successfully. This will create a record with a COMPLETED status and will save the result of the completed function in the idempotency record.

    Parameters

    • data: JSONValue

      the data payload that will be hashed to create the hash portion of the idempotency key

    • result: JSONValue

      the result of the successfully completed function

    Returns Promise<void>

Generated using TypeDoc