This topic describes how to connect an Alibaba Cloud service to EventBridge as an event source in the EventBridge console.
Prerequisites
EventBridge
EventBridge is activated, and the required permissions are granted to a Resource Access Management (RAM) user. For more information, see Activate EventBridge and grant permissions to a RAM user.
Simple Message Queue (formerly MNS) (SMQ)
SMQ is activated and the required permissions are granted to a RAM user. For more information, see Activate SMQ and authorize RAM users to access SMQ.
A queue is created. For more information, see Create a queue.
Elastic Compute Service (ECS)
Make sure that the disk is in the In Use or Unattached state.
If the disk is in the In Use state, make sure that the ECS instance is in the Running or Stopped state.
Step 1: Create an event rule
The event targets that you want to configure for an event rule must reside in the same region as the event rule.
Log on to the EventBridge console.
In the left-side navigation pane, click Event Buses.
In the top navigation bar, select a region.
On the Event Buses page, find the system event bus and click its name default.
In the left-side navigation pane, click Event Rules.
In the left-side navigation pane, click Event Rules. On the page that appears, click Create Rule.
In the Create Rule wizard, perform the following steps:
In the Configure Basic Info step, enter a rule name in the Name field and a rule description in the Description field. Then, click Next Step.
In the Configure Event Pattern step, select acs.ecs Elastic Compute Service (ECS) from the Event Source drop-down list and ecs:Snapshot:CreateSnapshotCompleted Completion of Snapshot Creation from the Event Type drop-down list, specify an event pattern in the Pattern Content code editor, and then click Next Step.
In the Configure Targets step, configure the event target. Then, click Create.
NoteYou can configure up to five event targets for an event rule.
Service Type: Select SMQ.
Queue: Select the queue that you created.
Message Body: Select Complete Event.
Step 2: Generate an ECS event (Create a snapshot for a disk)
Go to ECS console - Snapshots.
In the top navigation bar, select the region and resource group of the resource that you want to manage.
On the Disk Snapshots tab, click Create Disk Snapshot.
In the Create Snapshot dialog box, configure the parameters and click OK.
Parameter
Description
Resource Type
Default value: Cloud Disk, which allows you to create a snapshot for a cloud disk.
NoteYou can also set this parameter to Instance and select one or more ECS instances to create a snapshot-consistent group. Then, select the cloud disks for which you want to create snapshots from the ECS instances to ensure disk data consistency. For more information, see Create a snapshot-consistent group.
Cloud Disk
Select the disk for which you want to create a snapshot. You can select a system disk or a data disk.
Snapshot Name
Specify a name for the snapshot.
Retention Period
Specify the retention period of the snapshot. Valid values: Permanently (Until Deleted) and Retained for.
Permanently (Until Deleted): The snapshot is permanently retained and does not expire. After the maximum number of snapshots is reached, new snapshots cannot be created.
Retained for: Specify a retention period in days for the snapshot. After the retention period of the snapshot ends, the snapshot expires and is automatically deleted.
NoteFor the quotas on manual snapshots, see Overview.
If you specify a retention period for a snapshot, Released After xx Days is highlighted in the Retention Period column on the Disk Snapshots tab when the snapshot is a few days, such as 3 days, away from expiration. You can extend the retention period of a snapshot before the snapshot expires. For more information, see Extend the retention period of a snapshot.
To prevent unnecessary costs, we recommend that you delete unneeded snapshots at the earliest opportunity, regardless of whether the snapshots are retained permanently or for a specific number of days. For more information, see Delete a snapshot.
Advanced Settings
Instant Access
By default, the instant access feature is enabled for Enterprise SSD (ESSD) series disks (ESSDs, ESSD AutoPL disks, ESSD Entry disks, and Regional ESSDs)and is disabled for cloud disks of other categories.
NoteThe instant access feature allows you to use snapshots for operations, such as rolling back cloud disks, creating cloud disks, or sharing snapshots, within seconds after the snapshots are created, instead of after the snapshots are uploaded to OSS. For more information, see Use the instant access feature.
Tag
Specify tag key-value pairs for the snapshot to facilitate management.
Resource Group
Specify a resource group to which to assign the snapshot. You can use resource groups to manage snapshots at different levels.
(Optional) View the creation progress of the snapshot on the Disk Snapshots tab.
Snapshots are stored in OSS by default. This OSS bucket is hidden to ensure the long-term security of your data and provide flexible recovery options.

View the upload progress of the snapshot to OSS in the Progress column. When you move your pointer over Progress of Upload to OSS: Xx%, the estimated remaining time required to upload the snapshot is displayed.
NoteThe estimated time to upload a snapshot to OSS may vary based on several factors. For more information, see Time required to create a snapshot section in Considerations.
To cancel a snapshot creation task in progress, call the DeleteSnapshot operation.
If Progress of Upload to OSS: 100% is displayed in the Progress column, the snapshot is uploaded to OSS.
Step 3: Verify the result
Log on to the SMQ console.
In the left-side navigation pane, choose Queue Model > Queues.
In the top navigation bar, select a region.
On the Queues page, find the queue to which you routed the events and choose Send Messages in the Actions column.
In the Receive Message section, click Receive Message.
The following sample code provides an example of received events:
{ "id": "45ef4dewdwe1-7c35-447a-bd93-fab****", "source": "acs.ecs", "specversion": "1.0", "subject": "acs.ecs:cn-hangzhou:123456789098****:215672", "time": "2020-11-19T21:04:41Z", "type": "ecs:Snapshot:CreateSnapshotCompleted", "aliyunaccountid": "123456789098****", "aliyunpublishtime": "2020-11-19T21:04:42Z", "aliyuneventbusname": "default", "aliyunregionid": "cn-hangzhou", "aliyunpublishaddr": "172.25.XX.XX", "data": { "result": "accomplished", "snapshotId": "s-bp151qed0khxxxxxxxxx", "snapshotType": "user", "snapshotName": "cust51119970_xxxxxxxx_20211117114015", "diskId": "d-bp18dnj7u1xxxxxxxxx", "startTime": "2020-11-19T21:02:16Z", "endTime": "2020-11-19T21:04:17Z" } }
Step 4: Delete the event rule
Log on to the EventBridge console.
In the left-side navigation pane, click Event Buses.
In the top navigation bar, select a region.
On the Event Buses page, find the system event bus and click its name default.
In the left-side navigation pane, click Event Rules.
On the Event Rules page, find the rule that you want to delete and choose in the Operations column. Then, follow the prompted instructions to complete the process.