External systems such as monitoring tools, CI/CD pipelines, and custom applications often need to push events into your event-driven architecture. An HTTP/HTTPS event source provides a webhook URL that these systems can call. EventBridge determines whether to convert each incoming HTTP request into a CloudEvents v1.0-compliant event and push the event to the configured event target.
How it works
You create an HTTP/HTTPS event source on a custom event bus. EventBridge generates a webhook URL.
You configure the external system to send HTTP requests to this URL.
EventBridge determines whether to convert the request into a CloudEvents envelope and deliver it to the event target.
Prerequisites
Before you begin, make sure that you have:
Create the event source
Log on to the EventBridge console.
In the left-side navigation pane, click Event Buses.
In the top navigation bar, select a region.
Click the name of the target event bus.
In the left-side navigation pane, click Event Sources.
On the Event Source page, click Add Event Source.
In the Add Custom Event Source panel, set Name and Description, and then set Event Provider to HTTP/HTTPS Events.
Configure the following parameters, and then click OK.
Parameter
Description
Request Type
Protocol for the webhook URL. Select HTTPS, HTTP, or HTTP&HTTPS.
Request Method
HTTP methods the webhook URL accepts. Select one or more: GET, POST, PUT, DELETE, HEAD, PATCH.
Security Settings
Access control for incoming requests:
Optional -- Accept all requests without security checks.
CIDR Block -- Accept requests only from specified IP addresses or CIDR blocks.
Security Domain Name -- Accept requests only from a specified domain name.
CIDR Block
Required when Security Settings is CIDR Block. Specify up to five IP addresses or CIDR blocks.
Security Domain Name
Required when Security Settings is Security Domain Name. Specify up to five domain names.
After the event source is created, EventBridge generates a webhook URL. Copy this URL and configure it in the external system that sends events.
Event format
EventBridge converts HTTP requests that meet the specified requirements into a CloudEvents v1.0 envelope. Request headers map to data.headers and the request body maps to data.body.
{
"datacontenttype": "application/json",
"aliyunaccountid": "175299981560****",
"data": {
"headers": {
"Host": "175299981560****.eventbridge.cn-hangzhou.aliyuncs.com",
"Accept-Encoding": "gzip, deflate, br",
"accept": "*/*",
"Content-Length": "538",
"Content-Type": "application/json"
},
"path": "/webhook/putEvents",
"body": {
"infoId": 1,
"ruleName": "Test",
"state": "alerting",
"message": "EventBridge test info.",
"ruleId": "796014154722826****"
},
"httpMethod": "GET",
"queryString": {}
},
"subject": "acs:eventbridge:cn-hangzhou:175299981560****:eventbus/EventBridgeDemoBus/eventsource/my.httpSource",
"aliyunoriginalaccountid": "175299981560****",
"source": "my.httpSource",
"type": "eventbridge:Events:HTTPEvent",
"aliyunpublishtime": "2022-03-03T03:33:14.097Z",
"specversion": "1.0",
"aliyuneventbusname": "EventBridgeDemoBus",
"id": "ac0d574c-d862-4662-a87b-784e3d77****",
"time": "2022-03-03T11:33:14.093+08:00",
"aliyunregionid": "cn-hangzhou",
"aliyunpublishaddr": "42.120.XX.XX"
}CloudEvents envelope fields
The top-level fields follow the CloudEvents v1.0 specification:
| Field | Type | Description |
|---|---|---|
specversion | String | CloudEvents specification version. Always 1.0. |
type | String | Event type. For HTTP/HTTPS event sources, the value is eventbridge:Events:HTTPEvent. |
source | String | Event source name that you specified when creating the event source. |
subject | String | Resource identifier of the event source. |
id | String | Unique event identifier generated by EventBridge. |
time | String | Timestamp of the event. |
datacontenttype | String | Content type of the data field. |
aliyunaccountid | String | Alibaba Cloud account ID (partially masked). |
aliyunoriginalaccountid | String | Original Alibaba Cloud account ID (partially masked). |
aliyunregionid | String | Region where the event bus resides. |
aliyuneventbusname | String | Name of the event bus. |
aliyunpublishtime | String | Timestamp when the event was published. |
aliyunpublishaddr | String | IP address from which the event was published (partially masked). |
Data field reference
The data field contains the parsed HTTP request:
| Field | Type | Example | Description |
|---|---|---|---|
headers | Map | {"Host":"175299981560****.eventbridge.cn-hangzhou.aliyuncs.com", ...} | HTTP request headers. |
path | String | /webhook/putEvents | Request path. |
body | String or Map | {"infoId":1, "ruleName":"Test", ...} | Request body. Parsed as JSON when Content-Type is application/json; otherwise returned as a plain string. |
httpMethod | String | GET | HTTP method used in the request. |
queryString | Map | N/A | Query parameters from the request URL. The token parameter is excluded. |