- Newest
- Most votes
- Most comments
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)
To create a schedule in EventBridge Scheduler to invoke a specific route in your API Gateway, you can follow these steps:
-
Open the Amazon EventBridge Scheduler console.
-
Choose "Create schedule" and provide a name, description, and schedule group for your new schedule.
-
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.
-
In the "Select target" section, choose "Templated targets" for the Target API.
-
Select "Amazon API Gateway" as the target service.
-
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
-
You can also add any necessary headers or query parameters required by your API.
-
Configure additional options such as retry policy, dead-letter queue, and encryption settings as needed.
-
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
Relevant content
- asked a year ago
- Accepted Answerasked 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago