Schedule path parameters

aws
lambda

#1

Hello everyone,

I’m trying to configure multiple scheduled events for my lambda function.
I would like to know if it is possible to call my lambda function multiple times with a different path parameter for each schedule event.

Here is my function:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: first-endpoint/{size}
          method: GET
          integration: lambda
          request:
            parameters:
              paths:
                size: true

and my schedule events:

- schedule:
      name: test-schedule1
      description: 'Just a schedule test'
      rate: rate(1 minute)
      input:
        size: 1
- schedule:
      name: test-schedule2
      description: 'Just a second schedule test'
      rate: rate(1 minute)
      input:
        size: 2

I do not think using ‘input’ is the good solution.

In summary, the idea is that each schedule call my lambda function with a different path parameter (‘size’):
schedule1 calls first-endpoint/1
schedule2 calls first-endpoint/2
schedule3 calls first-endpoint/3

Do you have any advice ?

Thanks in advance.


#2

Depending on when the scheduled tasks run, you could have 1 scheduled function that rotates calls to your endpoints.

Or you can have 1 scheduled function that triggers a step function flow to run all your endpoints (functions) with the desired endpoints