By using AWS re:Post, you agree to the AWS re:Post Terms of Use

How can I create a schedule in EventBridge to invoke a specific route in my API Gateway?

0

I’m working on creating a schedule in AWS EventBridge to invoke an API Gateway endpoint at a specific rate. However, I’m encountering an issue where I can’t directly specify the API Gateway endpoint while setting up the schedule. The documentation doesn’t provide clear examples of the JSON body required to define the API Gateway ARN, endpoint, and headers.

Reference AWS EventBridge documentation: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-api-gateway-target.html

3 Answers
0

In the Template target section there is no API-Gateway option image

answered 19 days ago
0

Hello.

The EventBridge Scheduler that re:Post Agent answers cannot periodically execute APIs created with API Gateway.
To do this, you need to periodically execute the API using an EventBridge rule. (As of November 2024)

a

a

profile picture
EXPERT
answered 19 days ago
-1

To create a schedule in EventBridge Scheduler to invoke a specific route in your API Gateway, you can follow these steps:

  1. Open the Amazon EventBridge Scheduler console.

  2. Choose "Create schedule" and provide a name, description, and schedule group for your new schedule.

  3. Select the schedule type: one-time or recurring. For a recurring schedule, you can use a cron or rate expression to define when the schedule should run.

  4. In the "Select target" section, choose "Templated targets" for the Target API.

  5. Select "Amazon API Gateway" as the target service.

  6. For the API Gateway target, you'll need to provide the following information:

    • API ID: The ID of your API Gateway
    • Stage: The deployment stage of your API
    • Method: The HTTP method of your API route (GET, POST, etc.)
    • Path: The specific path of your API route
  7. You can also add any necessary headers or query parameters required by your API.

  8. Configure additional options such as retry policy, dead-letter queue, and encryption settings as needed.

  9. Review and create the schedule.

When setting up the schedule using the AWS CLI, SDKs, or CloudFormation, you'll need to provide an execution role that grants EventBridge Scheduler the necessary permissions to invoke your API Gateway endpoint. This role should have the appropriate IAM permissions to execute the API Gateway method.

It's important to note that while the EventBridge console can automatically set up an execution role based on your selected target, when using other methods to create a schedule, you must have an existing execution role with the required permissions.

By following these steps, you should be able to create a schedule that invokes your specific API Gateway route at the desired rate or time.
Sources
Getting started with EventBridge Scheduler - EventBridge Scheduler
Invoke a Lambda function on a schedule - AWS Lambda
CreateSchedule - EventBridge Scheduler
Using Amazon EventBridge Scheduler to start a Step Functions state machine execution - AWS Step Functions

profile picture
answered 19 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions