When a new employee is onboarded in HR systems, EventBridge captures the event and triggers automated creation of RDS database accounts with role-appropriate permissions, eliminating manual database user setup.
When HR systems emit employee onboarding events, developers can automate RDS account provisioning by routing these events through EventBridge. This eliminates manual SQL execution or console clicks, ensuring new hires instantly receive role-scoped database access upon onboarding.
aliyun eventbridge CreateEventBus --EventBusName hr-onboarding-bushttps://<region>.eventbridge.aliyuncs.com/api/v1/events.{"source": ["hr.system"], "detail-type": ["Employee.Onboarded"]}.https://rds.aliyuncs.com. Attach a RAM role with AliyunRDSFullAccess.POST and path to /?Action=CreateAccount&Version=2014-08-15.``json {"DBInstanceId":"rm-uf6wjk5xxxx","AccountName":"$.detail.employee_id","AccountPassword":"$.detail.temp_pw","AccountType":"Normal"} ``
GrantAccountPrivilege with AccountPrivilege mapped to $.detail.db_role (e.g., ReadWrite or ReadOnly).curl -X POST <eb_endpoint> -d '{"source":"hr.system","detail-type":"Employee.Onboarded","detail":{"employee_id":"dev_01","temp_pw":"P@ssw0rd!","db_role":"ReadOnly"}}'The HR system pushes a JSON payload to EventBridge’s HTTP API endpoint. EventBridge evaluates the payload against a pattern-matching rule, transforms the event into RDS OpenAPI parameters, and invokes the CreateAccount action via API Destination. RDS provisions the account, applies the mapped privileges, and returns a success status to EventBridge, which logs the execution for audit.
AliyunEventBridgeFullAccess and AliyunRDSFullAccess policies.InvalidPassword.employee_id without idempotency checks causes AccountAlreadyExists. Append unique suffixes or pre-check existence.Q: How does the system automatically provision database accounts for new employees? A: The system automatically creates RDS database accounts with role-appropriate permissions when a new employee is onboarded in an HR system. EventBridge captures the onboarding event to trigger this workflow, eliminating manual database user setup by integrating with ApsaraDB RDS account management.