How to Include Metadata in DynamoDB Stream Events

0

I'm currently working on a project where I need to implement asynchronous updates in DynamoDB and send events via a Lambda function triggered by a DynamoDB Stream. The goal is to notify consumers once a batch request for updating records has been successfully executed.

In this process, users provide a unique correlationId with their request. My question is, how can the Lambda function access this metadata, such as the correlationId, the request's origin (coming from the microservice), the userID, and other custom headers? These pieces of information are metadata of the updated table data, but they don't directly relate to the table's content.

Is there a way to send metadata with each Dynamodb write requests and transactWrite requests, such that they don't get stored to the table, but still are passed to the lambda triggered through the Stream events.

I would appreciate any guidance with this.

Neisha
質問済み 4ヶ月前211ビュー
1回答
0

There is many ways to achieve this, but personally as the customer is awaiting a batch of updates to complete, I would use Transactions if you are not doing so already.

Have two tables, one for the user items that your batch updating and one for your correlationId and custom header info. Have this event trigger its own Lambda function so that it can update the user. Set a small TTL on these items, as ultimately they are not needed once they invoke the payload.

profile pictureAWS
エキスパート
回答済み 3ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ