Alibaba Cloud - EventBridge

KevKev
2 min read

Alibaba EventBridge is a central point where you require important alert posting to an endpoint like a webhook. In this article I am using Alibaba Cloud EventBridge to post to a Teams Channel

In your Alibaba Account, activate EventBridge. Next go to EventBridge and by default you will have a listed Event Bus

In the Event Rules, click on Create Rule, give it a name and and click on Next Step

In the Next Step, select Custom Event Source, leave it Blank, Click on Next Step. A popup will appear as below. Click on OK

Next select the HTTPS, and put in your webhook URL.

In this example I am using Alicloud Container Registry, and I want to be notify if an image has been sync to another account. From Account A Container Registry to Account B Container Registry.
In the Parameters, put this

{
    "SyncRuleId":"$.data.SyncRuleId",
    "ImageFromRepoNamespaceName": "$.data.ImageFrom.RepoNamespaceName",
    "ImageFromImageTag": "$.data.ImageFrom.ImageTag",
    "ImageFromInstanceId": "$.data.ImageFrom.InstanceId",
    "ImageFromRepoName": "$.data.ImageFrom.RepoName",
    "ImageFromRegionId": "$.data.ImageFrom.RegionId",
    "EndTime": "$.data.EndTime",
    "TaskTrigger": "$.data.TaskTrigger",
    "StartTime": "$.data.StartTime",
    "ImageToRepoNamespaceName": "$.data.ImageTo.RepoNamespaceName",
    "ImageToImageTag": "$.data.ImageTo.ImageTag",
    "ImageToInstanceId": "$.data.ImageTo.InstanceId",
    "ImageToRepoName": "$.data.ImageTo.RepoName",
    "ImageToRegionId": "$.data.ImageTo.RegionId",
    "SyncBatchTaskId": "$.data.SyncBatchTaskId",
    "TaskStatus": "$.data.TaskStatus",
    "SyncTaskId": "$.data.SyncTaskId"
 }

In Template, put the below

{'text':'SyncTaskId: ${SyncTaskId}, StartTime: ${StartTime} ImageFromRepoNamespaceName: ${ImageFromRepoNamespaceName} ImageFromImageTag: ${ImageFromImageTag} ImageFromInstanceId: ${ImageFromInstanceId} ImageFromRepoName: ${ImageFromRepoName} ImageFromRegionId: ${ImageFromRegionId}, EndTime: ${EndTime}, ImageToRepoNamespaceName: ${ImageToRepoNamespaceName} ImageToImageTag: ${ImageToImageTag}  ImageToInstanceId: ${ImageToInstanceId} ImageToRepoName:${ImageToRepoName} ImageToRegionId: ${ImageToRegionId}, TaskStatus: ${TaskStatus}'}

Next Click on Create and a new template will be created.
You can attach that role in your Alibaba Cloud Container Registry delivery chain

0
Subscribe to my newsletter

Read articles from Kev directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kev
Kev