All Products
Search
Document Center

EventBridge:CreateEventSource

Last Updated:Dec 19, 2025

Creates an external event source.

Operation description

Creates an external event source.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

EventSourceName

string

Yes

The name of the event source.

myrabbitmq.sourc

Description

string

No

The description of the event source.

RabbitMQ事件源

LinkedExternalSource

boolean

No

Specifies whether to connect to an external data source.

true

ExternalSourceType

string

No

The type of the external data source.

RabbitMQ

ExternalSourceConfig

object

No

The configuration of the external data source.

{\"Schedule\":\"0 */10 * * * *\",\"TimeZone\":\"GMT+0:00\"}

EventBusName

string

Yes

The name of the event bus to which the event source is attached.

my-event-bus

SourceMNSParameters

object

No

The parameters that are configured if you specify Message Service (MNS) as the event source. If you specify MNS as the event source, the RegionId, IsBase64Decode, and QueueName parameters are required.

RegionId

string

No

The region where the MNS queue is located. Valid values: cn-qingdao, cn-beijing, cn-zhangjiakou, cn-huhehaote, cn-wulanchabu, cn-hangzhou, cn-shanghai, cn-shenzhen, cn-guangzhou, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, us-west-1, us-east-1, ap-south-1, me-east-1, and cn-north-2-gov-1.

cn-hangzhou

QueueName

string

No

The name of the MNS queue.

MyQueue

IsBase64Decode

boolean

No

Specifies whether to enable Base64 decoding. Valid values: `true` and `false`.

true

SourceRocketMQParameters

object

No

The parameters that are configured if you specify Message Queue for Apache RocketMQ as the event source.

RegionId

string

No

The region where the Message Queue for Apache RocketMQ instance is located.

cn-hangzhou

InstanceId

string

No

The ID of the Message Queue for Apache RocketMQ instance. For more information, see Limits.

MQ_INST_164901546557****_BAAN****

Topic

string

No

The name of the topic on the Message Queue for Apache RocketMQ instance. For more information, see Limits.

mytopic

Tag

string

No

The tag that is used to filter messages.

test

Offset

string

No

The consumer offset for messages. Valid values: CONSUME_FROM_LAST_OFFSET: Consume messages from the latest offset. CONSUME_FROM_FIRST_OFFSET: Consume messages from the earliest offset. CONSUME_FROM_TIMESTAMP: Consume messages from the offset at a specified point in time. Default value: CONSUME_FROM_LAST_OFFSET.

CONSUME_FROM_LAST_OFFSET

Timestamp

integer

No

The timestamp that specifies the consumer offset. This parameter is required only if you set Offset to CONSUME_FROM_TIMESTAMP.

1636597951964

GroupID

string

No

The ID of the consumer group for the Message Queue for Apache RocketMQ instance.

GID-test

InstanceType

string

No

The instance type.

  • Cloud_4: a v4.0 instance

  • Cloud_5: a v5.0 instance

Cloud_4

InstanceNetwork

string

No

This parameter is not used.

InstanceVpcId

string

No

The ID of the virtual private cloud (VPC). This parameter is required if the instance is deployed in a VPC.

vpc-bp1a4gmlk31hyg6pt****

InstanceVSwitchIds

string

No

The ID of the vSwitch. This parameter is required if the instance is deployed in a VPC.

vsw-bp10rbrt6rb6vrd89****

InstanceSecurityGroupId

string

No

The ID of the security group. This parameter is required if the instance is deployed in a VPC.

sg-catalog-eventlist****

AuthType

string

No

The authentication type. Set the value to ACL. You can also leave this parameter empty.

ACL

InstanceEndpoint

string

No

The endpoint of the instance.

registry-vpc****.aliyuncs.com

InstanceUsername

string

No

The username for the instance.

root

InstancePassword

string

No

The password for the instance.

******

SourceRabbitMQParameters

object

No

The parameters that are configured if you specify Message Queue for RabbitMQ as the event source.

RegionId

string

No

The region where the Message Queue for RabbitMQ instance is located.

cn-hangzhou

InstanceId

string

No

The ID of the Message Queue for RabbitMQ instance. For more information, see Limits.

amqp-cn-nif22u74****

VirtualHostName

string

No

The vhost name of the Message Queue for RabbitMQ instance. For more information, see Limits.

eb-connect

QueueName

string

No

The name of the queue on the Message Queue for RabbitMQ instance. For more information, see Limits.

demo

SourceSLSParameters

object

No

The parameters that are configured if you specify Simple Log Service (SLS) as the event source.

Project

string

No

The name of the SLS project.

test-project

LogStore

string

No

The name of the Logstore.

test-logstore

ConsumePosition

string

No

The consumer offset. You can start consumption from the earliest offset (`begin`), the latest offset (`end`), or a specified time. The time is measured in seconds.

end

RoleName

string

No

The Resource Access Management (RAM) role that is used to read logs from SLS. To grant EventBridge the permissions to read logs, you must select Alibaba Cloud Service for the trusted entity and EventBridge for the trusted service when you create the RAM role in the RAM console. For information about the access policy of this role, see Custom Simple Log Service event source.

testRole

SourceHttpEventParameters

object

No

The parameters that are configured if you specify HTTP as the event source.

Type

string

No

The protocol type that the webhook supports. Valid values:

  • HTTP

  • HTTPS

  • HTTP&HTTPS

HTTPS

Method

array

No

The HTTP request methods that the webhook supports. You can select multiple values. Valid values:

  • GET

  • POST

  • PUT

  • PATCH

  • DELETE

  • HEAD

  • OPTIONS

  • TRACE

  • CONNECT

string

No

The HTTP request methods that the webhook supports. You can select multiple values. Valid values:

  • GET

  • POST

  • PUT

  • PATCH

  • DELETE

  • HEAD

  • OPTIONS

  • TRACE

  • CONNECT

GET

SecurityConfig

string

No

The type of security configuration. Valid values:

  • none: No configuration is required.

  • ip: IP address range.

  • referer: Security domain name.

none

Ip

array

No

The IP address range for security settings. This parameter is required only if you set SecurityConfig to ip. You can specify a single IP address or a CIDR block.

string

No

The IP address range for security settings. This parameter is required only if you set SecurityConfig to ip. You can specify a single IP address or a CIDR block.

10.0.0.0/8

Referer

array

No

The security domain name. This parameter is required only if you set SecurityConfig to referer. You can specify a domain name.

string

No

The security domain name. This parameter is required only if you set SecurityConfig to referer. You can specify a domain name.

aliyundoc.com

SourceScheduledEventParameters

object

No

The parameters that are configured if you specify a scheduled event as the event source.

Schedule

string

No

The cron expression.

10 * * * * *

TimeZone

string

No

The time zone for the cron expression.

GMT+0:00

UserData

string

No

A JSON string.

{"a": "b"}

SourceKafkaParameters

object

No

The parameters that are configured if you specify Message Queue for Apache Kafka as the event source.

InstanceId

string

No

The instance ID.

pc-2zehmg67txzuyuuwl****

ConsumerGroup

string

No

The ID of the consumer group that subscribes to the topic.

wechat_peer_****

Topic

string

No

The topic name.

prod_ma_dispatch_center_call_re****

OffsetReset

string

No

The consumer offset.

latest

RegionId

string

No

The region ID.

cn-hangzhou

MaximumTasks

integer

No

The concurrent consumption quota, which is the number of consumers.

1

Network

string

No

The network type. Valid values:

Default

SecurityGroupId

string

No

You must specify a security group ID for self-managed networks.

sg-8vbf66aoyp0wfzrz****

VSwitchIds

string

No

The vSwitch ID of the user-created VPC.

vsw-bp127azpeirmwu4q9****

VpcId

string

No

This parameter is required for self-managed networks.

vpc-2ze5ejm986a73qq3v****

SourceOSSEventParameters

object

No

EventTypes

array

No

string

No

StsRoleArn

string

No

MatchRules

array

No

array<object>

No

object

No

Prefix

string

No

Suffix

string

No

Name

string

No

MatchState

boolean

No

`POST /openapi/createEventSource HTTP/1.1 Host: 164901546557****.eventbridge.cn-hangzhou.aliyuncs.com Date: Sat, 18 Apr 2020 05:30:41 GMT x-eventbridge-version: 2020-04-01 Authorization: acs vZ3VL0SuJdHi****:Jo2PbT******azYAYoYslKLvWzg= Content-Type: application/json;charset=UTF-8 Content-Length: 26`

`{ "EventSourceName":"myRabbitMQ.source", "Description":"RabbitMQ event source", "SourceRabbitMQParameters":{ "RegionId":"cn-hangzhou", "InstanceId":"amqp-cn-nif22u74****", "VirtualHostName":"eb-connect", "QueueName":"demo" }, "EventBusName":"my-event-bus" }`

Response elements

Element

Type

Description

Example

object

The parameters of the request.

Message

string

The error message that is returned if the request fails.

Remote error. requestId: [A8EFABD2-95B9-1C46-9E01-xxxx], error code: [CreateRelatedResourceFailed], message: [Create related resource failed, EntityNotExist.Role : The role not exists: xxxx. \r\nRequestId : xxxx-168C-54ED-8FEB-BF11CB70AEB7]

RequestId

string

The ID of the request.

2922208e-e1c6-43ee-bfd1-aca50263bc8a

Data

object

The data that is returned.

EventSourceARN

string

The Alibaba Cloud Resource Name (ARN) of the event source.

acs:eventbridge:cn-hangzhou:164901546557****:eventbus/my-event-bus/eventsource/mymns.source

Code

string

The response code. The value Success indicates that the request was successful. For more information about other error codes, see Error codes.

  • Success: The operation was successful.

  • Other values: An error code. For more information, see Error codes.

Success

Success

boolean

Indicates whether the request was successful. A value of `true` indicates that the request was successful.

true

Examples

Success response

JSON format

{
  "Message": " Remote error. requestId: [A8EFABD2-95B9-1C46-9E01-xxxx], error code: [CreateRelatedResourceFailed], message: [Create related resource failed, EntityNotExist.Role : The role not exists: xxxx. \\r\\nRequestId : xxxx-168C-54ED-8FEB-BF11CB70AEB7]   ",
  "RequestId": "2922208e-e1c6-43ee-bfd1-aca50263bc8a",
  "Data": {
    "EventSourceARN": "acs:eventbridge:cn-hangzhou:164901546557****:eventbus/my-event-bus/eventsource/mymns.source"
  },
  "Code": "Success",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

403 ServiceNotEnable Service not enable

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.