What is the best way to migrate invocation of Lambda function from Cloudwatch event to Event Source Mapping(Triggers) with minimum risk and downtime?
Our application uses cloudwatch event rule to invoke Lambda at fixed rate, which then polls SQS queue to get messages, we want to automatically invoke the lambda using SQS trigger(ESM).
Brainstormed a couple approaches:
Option 1. Hookup both, trigger and cloudwatch event to existing Lambda, then slowly deprecate event rule.
Option 2. Using duplicate lambda with event source as SQS queue and divide the traffic, deprecate original lambda later.
Option 3. Add additional SQS(subscribed to same SNS) and Lambda pair which uses the trigger, deprecate the original later.
I am sure many teams might have done similar migration, any insights would be appreciated.