Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

amazon web services - How to schedule a lambda function with REST API

Having four API in one lambda function

  1. https://*******.amazonaws.com/dev/candidate,
  2. https://*******.amazonaws.com/dev/incrementalfile,
  3. https://*******.amazonaws.com/dev/increment,
  4. https://*******.amazonaws.com/dev/s3upload

These are my 4 APIs and I have to schedule these 4 API Gateway for every day at 10:30 AM from Monday to Friday but I am unable to find the solution for scheduling API gateway. here is my .yml file

service: ****
plugins:
  - serverless-plugin-typescript
provider:
  name: aws
  runtime: nodejs10.x
  memorySize: 1024
  stage: dev
  region: ***
  timeout: 60
 
functions:
  ****:
    handler: src/server.*****Handler
    events:
      - http: 'ANY /{proxy+}'
      - cors: true

Need to schedule http event but not able to find the solution I also used 'node schedule' but that is not working

question from:https://stackoverflow.com/questions/65936795/how-to-schedule-a-lambda-function-with-rest-api

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Assuming you wanna call API Gateway endpoints everyday day at 10:30 AM. You can use CloudWatch Event Rule and register target a step machine that calls the API gateway

Introducing Amazon API Gateway service integration for AWS Step Functions

Periodically Start a State Machine Execution Using CloudWatch Events


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...