This topic shows how to connect an official Alibaba Cloud event source in the EventBridge console.
Prerequisites
-
EventBridge
-
ApsaraMQ for MNS
-
ECS
-
The disk must be in the In Use or Unattached state.
-
If the disk is in the In Use state, the instance must be in the Running or Stopped state.
-
Step 1: Create an event rule
The event target and the event rule must be in the same region.
- 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, click the default system event bus.
- In the left-side navigation pane, click Event Rules.
-
On the Event Rules page, click Create Rule.
-
In the Create Rule wizard, complete these steps:
-
In the Configure Basic Info step, enter a rule name in the Name field and a description in the Description field, and then click Next.
-
In the Configure Event Pattern step, set Event Sources to acs.ecs and Event Type to ecs:Snapshot:CreateSnapshotCompleted. In the Pattern Content editor, enter the event pattern, and then click Next.
-
In the Configure Targets step, configure the event target, and then click Create.
NoteYou can add up to five event targets to a single event rule.
-
Service Type: Select ApsaraMQ for MNS.
-
Queue: Select the queue you created.
-
Message Body: Select Complete Event.
-
-
Step 2: Generate an ECS event
-
Go to the ECS console - Block Storage - Disks page. In the upper-left corner, select the target region and resource group.
-
In the Create Snapshot column for the target disk, click Create Snapshot.
-
In the Create Snapshot dialog box, set the snapshot parameters and click OK.
ImportantDuring snapshot creation, do not change the instance state (for example, by stopping or restarting the instance). Otherwise, the snapshot creation task fails.
Parameter
Description
Snapshot Name
Enter a name for the snapshot.
The name must be 2 to 128 characters in length. It cannot start with
auto, a special character, a number,http://, orhttps://. It can contain only periods (.), underscores (_), hyphens (-), and colons (:).Retention Period
-
Permanent: The snapshot is not automatically deleted. Note that the maximum number of manual snapshots you can create is 256.
-
Custom: After the retention period ends, the system automatically deletes the snapshot.
If you no longer need a snapshot, we recommend that you delete it promptly to avoid incurring charges.
-
-
View the snapshot creation progress.
Go to the ECS console - Snapshots page to view the creation progress in the Progress column.
-
Hover over Progress in the Progress column to view the estimated time remaining.
The estimated time remaining is dynamic and is updated based on the allocated bandwidth and data size. By default, snapshots are stored in OSS. The OSS bucket is not directly visible or accessible to you.
-
When the progress column shows Uploading to OSS: 100%, the snapshot upload is complete.
-
Step 3: Verify the result
-
Log on to the ApsaraMQ for MNS console.
-
In the left-side navigation pane, choose .
-
In the top navigation bar, select a region.
-
On the Queues page, find the target queue and in the Actions column, choose .
-
In the Receive Message section, click Receive Message.
The following code block shows a sample received message.
{ "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, click the default system event bus.
- In the left-side navigation pane, click Event Rules.
-
On the Event Rules page, find the target rule and in the Actions column, choose , and then follow the on-screen instructions to delete the rule.