Can lambda know the specific attribute which changed in the dynamo db table update, when a lambda is triggered by dynamo db table update item??

0

My client has an architecture to trigger a lambda whenever the dynamo db table is updated. However, my client needs to perform a check on the specific attribute which changed. The lambda payload gives the new and old image. However the lambda should compare and check what changed between the old and new image in order to proceed to the next step. In this case, is there any way the lambda can know which specific attribute changed when an item is updated in a dynamo db ?

AWS
질문됨 2년 전1077회 조회
1개 답변
3

Yes, if you configure your DynamoDB Stream to emit NEW_AND_OLD_IMAGES then the Lambda can see the before and after of the update. You will then have to decide in your application logic which values where changed by comparing the OLD_IMAGE to the NEW_IMAGE

profile pictureAWS
전문가
답변함 2년 전
profile pictureAWS
전문가
검토됨 2년 전
  • To maybe add to that: the way we do this comparison is by using jsonpatch which is a standardized way of representing the diff between two JSON objects. It is also available in a lot of languages.

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

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

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

관련 콘텐츠