- Newest
- Most votes
- Most comments
Thank you, that worked. I am looking to modify the schedule, and this is perfect. Thanks
Hello.
If you use the EventBridge scheduler, you can retrieve it in a list using the "list_schedules()" API.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/scheduler/client/list_schedules.html
Use the following Python script to list all EventBridge schedules. This script initializes a Boto3 client for EventBridge Scheduler and uses the list_schedules method to fetch the schedules.
import boto3
def list_eventbridge_schedules(region_name):
# Initialize the boto3 client for EventBridge Scheduler
client = boto3.client('scheduler', region_name=region_name)
# List all schedules
schedules = []
response = client.list_schedules()
schedules.extend(response['Schedules'])
# Handle pagination if there are more schedules
while 'NextToken' in response:
response = client.list_schedules(NextToken=response['NextToken'])
schedules.extend(response['Schedules'])
return schedules
if __name__ == "__main__":
region = "us-east-1" # Replace with your AWS region
schedules = list_eventbridge_schedules(region)
# Print out the schedules
for schedule in schedules:
print(schedule)
Explanation
1. Initialize Boto3 Client:
client = boto3.client('scheduler', region_name=region_name): Initializes a Boto3 client for EventBridge Scheduler.
2. List Schedules:
client.list_schedules(): Retrieves a list of schedules. If there are more schedules than can be returned in a single response, the NextToken key is used for pagination.
The script handles pagination by checking for the NextToken key and making additional requests to retrieve all schedules.
3. Print Schedules:
The script iterates over the retrieved schedules and prints each one.
Additional Considerations
- Filtering Schedules: If you need to filter schedules based on specific criteria (e.g., by name or state), you can add additional logic to the script to handle this.
- Modifying Step Functions: Once you have the list of schedules, you can add logic to modify the associated Step Functions as required.
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago

If you just want to display a list in json, you can get it with the code below.