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달 전210회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠