Disable DynamoDB stream, restore data, not process any events during restore period with lambda trigger.

0

I'm attempting to prepare a DynamoDB disaster recovery plan. Our stack uses a DynamoDB table with a stream enabled. We also have a lambda trigger configured to listen for stream events. These events are processed and make a bunch of downstream changes.

In a DR situation Im looking for the ability to create a temp table from a snapshot, and then copy that restored data into a new 'DR' table that's managed by IAC. It's not ideal for the stream and lambda trigger to process events from the copy. That would cause a bunch of downstream issues.

I see it's possible to disable/ enable the dynamo stream, and although you'll receive a new arn after a stream is disabled/ enabled I can't find anything in documentation if behind the scenes you're connecting to the original stream log or not? If I configure my lambda trigger to listen to the stream will all the events from the copy start processing?

If I dont have the stream enabled while Im copying data to the table will the stream log be empty when I enable?

Another option Im looking into is lambda event source mapping, specifically the starting position. I might be able to use the 'latest' flag.

  • What kind of disaster scenario are you mitigating against? Are your efforts here really necessary?

질문됨 2년 전1398회 조회
1개 답변
2
수락된 답변

I see it's possible to disable/ enable the dynamo stream, and although you'll receive a new arn after a stream is disabled/ enabled I can't find anything in documentation if behind the scenes you're connecting to the original stream log or not?

No, when you disable/enable a stream it changes ARN and is completely separate to the old stream.

If I configure my lambda trigger to listen to the stream will all the events from the copy start processing?

It depends how you "copy" the data. If your "copy" means restore the table from backup, then no the events will not be in the stream. If your "copy" is done by you calling PutItem or BatchWriteItems to insert data, then yes it will enter the stream.

If I dont have the stream enabled while Im copying data to the table will the stream log be empty when I enable?

Yes

Another option Im looking into is lambda event source mapping, specifically the starting position. I might be able to use the 'latest' flag.

LATEST will start reading from the the point of when you enable the trigger on the ESM. So if your copy puts events on the stream and you later create an ESM with iterator position as LATEST your Lambda will disregard all the data from the copy.

profile pictureAWS
전문가
답변함 2년 전

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

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

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

관련 콘텐츠