AWS Eventbridge Scheduler REST API的完整调用URL格式如下:
https://events.{region}.amazonaws.com/{version}/api/schedule
其中,{region}代表希望使用AWS服务的区域,{version}代表API的版本号,例如,如果想要在美国东部(US East)使用最新版本的API,URL将如下所示:
https://events.us-east-1.amazonaws.com/latest/api/schedule
下面是一个Python代码示例,在美国东部(US East)区域,调用AWS Eventbridge Scheduler REST API的完整URL:
import requests import json
region_name = 'us-east-1' api_version = 'latest' url = f'https://events.{region_name}.amazonaws.com/{api_version}/api/schedule'
payload = { "Name": "SampleRule", "ScheduleExpression": "rate(5 minutes)", "State": "ENABLED", }
headers = { 'Content-Type': 'application/x-amz-json-1.1' }
response = requests.post(url, headers=headers, data=json.dumps(payload)) print(response.json())