DingTalk or Lark approval events (e.g., new hire onboarding, resource request) flow into EventBridge, which triggers ECS Cloud Assistant provisioning scripts, then routes completion status and audit results back to DingTalk/Lark group chats as notifications — forming a full request-to-confirmation workflow.
Developers use this bidirectional loop to automate infrastructure provisioning triggered by HR or IT approval workflows in DingTalk or Lark. It eliminates manual ticket routing by capturing approval payloads, executing remote provisioning scripts on ECS instances, and pushing real-time completion status and audit logs back to the originating group chat.
eb-integrate-events to provision a custom event source. Map the inbound webhook to a CloudEvents schema:``json {"source": "dingtalk.approval", "detail-type": "ProvisionRequest", "detail": {"emp_id": "E123", "role": "devops"}} ``
$.source == "dingtalk.approval". Set the target to ACS::ECS::RunCommand with the following target config:``json {"CommandId": "c-uf6d8f...", "InstanceIds": ["i-uf6abc..."], "Timeout": 300} ``
/opt/provision.sh to the target Alinux ECS instance. The script must parse {{.detail.emp_id}}, install dependencies, create users, and exit with 0 on success.ecs-execute-instances:``bash aliyun ecs InvokeCommand --CommandId c-uf6d8f... --InstanceId i-uf6abc... --Parameters '{"emp_id":"E123","role":"devops"}' ``
$.detail.InvocationStatus == "Success". Set its target to an HTTP POST action that calls the DingTalk/Lark webhook with the audit payload.DingTalk/Lark pushes approval payloads via HTTPS to an EventBridge HTTP API event source. EventBridge evaluates a pattern-matching rule and routes the event to the ECS Cloud Assistant target. Cloud Assistant securely executes the shell script on the designated Alinux ECS instance via the acs:ecs:RunCommand API. Upon completion, Cloud Assistant emits an InvocationResult event back to EventBridge. A secondary rule matches this completion event and triggers an HTTP POST to the original DingTalk/Lark webhook, closing the loop with real-time status.
aliyun-service (Cloud Assistant agent) activeAliyunEventBridgeRolePolicy and AliyunECSAssistantAccessaliyun-service isn't running. Verify with systemctl status alicloud-service.InvocationTimeout; adjust Timeout in RunCommand./opt/provision.sh to prevent duplicate resource creation.Q: How does the bidirectional DingTalk or Lark ECS provisioning workflow operate? A: The workflow routes DingTalk or Lark approval events into EventBridge to trigger ECS Cloud Assistant provisioning scripts, then sends the completion status and audit results back to the respective group chats. This creates a full request-to-confirmation cycle that automates processes like new hire onboarding or resource requests.