In Data Management (DMS), resources are isolated between Alibaba Cloud accounts. To access resources in another account's DMS tenant or register your instances in another account's DMS tenant, you must perform cross-account operations. This topic describes how to register instances and access resources across Alibaba Cloud accounts.
Register an instance across Alibaba Cloud accounts
Usage notes
Only Alibaba Cloud instances can be registered across accounts.
Before you register an instance across accounts, the resource owner must have logged on to DMS at least once.
If you log on with an account of Alibaba Cloud International Website (alibabacloud.com), make sure that the resource owner has logged on to DMS and the resource processing region matches the region of the current account. You can check the current resource processing region in the DMS console:
Simple mode: Click the profile icon in the upper-right corner, choose Settings, and then check the Data Processing Region.
Non-simple mode: Hover over the gear icon in the upper-right corner and then check the Data Processing Region.
Grant permissions
Before you register an instance across accounts, grant the RAM user the permissions to manage DMS resources and the database instance types that you want to register.
Assume that Alibaba Cloud account A wants to register a resource from Alibaba Cloud account B into account A's DMS tenant. A RAM user under account B must perform the following steps in the RAM console:
Log on to the RAM console by using a RAM user under the resource owner's Alibaba Cloud account B that has the
AliyunRAMFullAccesspermission.On the Roles page, create a RAM role and configure a trust policy for account A. Use either of the following methods:
Method 1: Visual editor
On the Create Role page, click Switch to Policy Editor.
For Select Trusted Entity, select Alibaba Cloud Account. The Switch to Policy Editor button is on the right side of the prompt at the bottom of the page.
On the Visual Editor tab, set Principal to Cloud Service. Configure the following parameters:
In the text box under Other Account, enter the UID of Account A.
For Cloud Service, select Data Management/DMSEnterprise.
Click OK.
Method 2: Script editor
On the Create Role page, click Switch to Policy Editor.
On the Script Editor tab, enter the following policy.
This trust policy allows the specified user to manage resources for cross-account instance registration.
{ "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": [ "<UID of Alibaba Cloud account A>@dms.aliyuncs.com" ] } } ], "Version": "1" }Click OK.
On the Policies page, create a custom policy. For example, name the policy
DmsCrossAccountPolicy.The following database types and access methods (VPC) are supported in the permission policy: Tair (Redis OSS-compatible), PolarDB-X, OceanBase, ApsaraDB for Lindorm, Hologres, GDB, SelectDB, and ClickHouse Enterprise Edition.
NoteFor RDS, PolarDB for MySQL, PolarDB for PostgreSQL, and PolarDB for PostgreSQL(Compatible with Oracle), skip Steps 3 and 4 and go to Step 5.
The following example policy allows database registration through a VPC.
{ "Statement": [ { "Action": [ "vpc:DescribeVpcs" ], "Resource": "*", "Effect": "Allow" } ], "Version": "1" }On the Roles page, attach the
DmsCrossAccountPolicypolicy to the role created in Step 2. For more information, see Manage permissions for a RAM role.On the Roles page, click the role name and copy the ARN from the role details page.
Register the instance
When user A registers a database, enter the role ARN.
In the Register Database dialog box, in the Basic Information section, set Database Type to MySQL and configure Instance Region. In the Cross-account ARN field, enter the ARN copied in Step 4.
Access instance resources across Alibaba Cloud accounts
To access instance resources in another Alibaba Cloud account's DMS tenant, perform the following steps.
Prerequisites
The accessor (user A) and the resource owner (user B) belong to different Alibaba Cloud accounts. The resource owner's account (account B) must have an existing DMS tenant.
Grant permissions to the accessor
Log on to the RAM console by using a RAM user under the resource owner's Alibaba Cloud account B that has the
AliyunRAMFullAccesspermission.On the Roles page, create a RAM role.
NoteIn the Other Account field, enter the UID of the accessor's Alibaba Cloud account A.
For Select Trusted Entity, select Alibaba Cloud Account, and then click OK.
On the Roles page, attach the
AliyunDMSLoginConsoleAccesspolicy (for logging on to the DMS console) to the role created in Step 2. For more information, see Manage permissions for a RAM role.
Access DMS resources
Log on to the Alibaba Cloud Management Console by using a RAM user under Alibaba Cloud account A that has the
AliyunSTSAssumeRoleAccesspermission.In the upper-right corner, click your profile picture and switch your identity.
Enter the UID of the resource owner's Alibaba Cloud account B and the role name that you created.
Click Submit.
After the identity switch is complete, go to Data Management DMS 5.0.
NoteDMS automatically assigns you the regular user role. To perform change or export operations on instance resources, apply for additional permissions in DMS.