skip to Main Content

I want to invoke lambda multiple times but not concurrent with invocation having 30mins(some minutes) having event custom information & buffer in between 2 lambda triggers. So basically, 1 lambda invocations at a time.

My Expectations:

  • Any AWS service to send/store all triggers at once but triggering lambda with wait functionality before other Lambda invocation.
  • Trigger1 -> Lambda -> 30mins -> Trigger2 -> Lambda -> 30mins

Initially, I thought to have SQS which will trigger Lambda with delaySeconds approach. However, In case of burst messages with delay seconds attribute, they tend to work asynchronously & trigger lambda within few seconds.

Expected Result:

SQS -> Message1 -> Lambda Trigger -> 30 mins -> Message2 -> Lambda Trigger -> 30 mins

Reality:


SQS -> 30mins -> Message1 -> Lambda Trigger

    -> 30mins -> Message2 -> Lambda Trigger (Few second delay only)

Then I thought of having a step function with wait time post lambda invocation, but with multiple concurrent executions, I’ll get the same result.

I want to know how can I achieve such requirement.

2

Answers


  1. Configure another Lambda function as the "sink" for all your events.
    This Lambda writes whatever event it received into a common storage (Could be RDS). This lambda function need no concurrency limitation

    Configre the lambda you want to throttled/buffered to be triggered by EventBridge (Time based trigger – every 30 minutes). That lambda function should read all pending events from the common storage and decide what to do

    Login or Signup to reply.
  2. If you need such delays then SQS triggering Lambda is not the way you want to go propably.

    Change your lambda code to be a message consumer which manually takes message from queue (with limit 1 on consumed messages according to your description), run it as scheduled lambda event every 30 minuts and that’s it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search