Resource Access Management (RAM) is the identity and access management service provided by Alibaba Cloud. RAM allows you to create and manage RAM users under your Alibaba Cloud account and assign specific permissions to each RAM user. This way, you can grant or deny RAM users' access to cloud resources for authorization management.
Background
-
RAM users belong to an Alibaba Cloud account and cannot own any resources. All resources are owned by the Alibaba Cloud account.
-
After a RAM user creates an AnalyticDB for MySQL cluster, only that RAM user and the Alibaba Cloud account can view or use the cluster. Other RAM users must be granted permissions before they can view or use the cluster.
Use cases
After you create an AnalyticDB for MySQL cluster by using your Alibaba Cloud account, if multiple users in your organization need to use the AnalyticDB for MySQL cluster, these users can only share the AccessKey pair of your Alibaba Cloud account.
Sharing the AccessKey pair of your Alibaba Cloud account with multiple users poses the following risks.
-
Your AccessKey pair is shared among multiple people, which increases the risk of credential leakage.
-
You cannot control the operations that a specific user can perform on the cluster, such as scaling out or restarting the cluster.
In this case, you can create RAM users and grant them the required permissions. Then, your users can access or manage your AnalyticDB for MySQL clusters through RAM users.
Procedure
To access or manage an AnalyticDB for MySQL cluster through a RAM user, perform the following two steps.
Create a RAM user
-
Log on to the RAM console.
-
In the left-side navigation pane, choose .
-
On the Users page, click Create User. Enter a Logon Name and a Display Name.
NoteClick Add User to create multiple RAM users at a time.
-
In the Access Mode section, select Console Access or Open API Access.
-
Console Access: allows you to configure basic logon security settings, including auto-generated or custom logon passwords, whether to require a password reset upon next logon, and whether to enable multi-factor authentication (MFA).
-
Open API Access: automatically creates an AccessKey pair for the RAM user. The RAM user can then use development tools to access AnalyticDB for MySQL clusters.
For account security, we recommend that you select only one access mode for each RAM user. This prevents a RAM user from accessing your AnalyticDB for MySQL clusters through AccessKey pairs after the user leaves your organization.
-
-
Click OK to create the RAM user.
Grant permissions to a RAM user
-
Log on to the RAM console.
-
In the left-side navigation pane, choose .
-
On the Users page, click Add Permissions on the right side of the target RAM user.
-
On the Add Permissions page, set the permission type to System Policy. Enter a policy name to find the target policy and click it to add it to the Selected section.
WarningDo not grant excessive permissions. Over-privileged operators can perform arbitrary operations, which may cause security risks or losses.
Policy descriptions:
-
Enterprise Edition, Basic Edition, and Data Lakehouse Edition cluster permissions:
-
AliyunADBReadOnlyAccess: grants read-only access to Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters.
-
AliyunADBFullAccess: grants permissions to manage Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters.
-
AliyunADBDeveloperAccess: grants developer permissions for Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters. Compared with the AliyunADBFullAccess policy, AliyunADBDeveloperAccess does not include permissions to create, modify, or delete clusters, or to bind RAM users.
-
-
Data Warehouse Edition cluster permissions:
-
AliyunADBReadOnlyAccess: grants read-only access to Data Warehouse Edition clusters.
-
AliyunADBFullAccess: grants permissions to manage Data Warehouse Edition clusters.
-
-
-
Click OK to grant permissions to the RAM user.
After you grant the required permissions to a RAM user, the RAM user can access or manage your AnalyticDB for MySQL clusters.
Create a custom policy
If you need to grant fine-grained instance-level operation permissions to RAM users, you must create custom policies in RAM.
-
Log on to the RAM console.
-
In the left-side navigation pane, choose .
-
Click Create Policy. This topic uses the creation of a management policy for AnalyticDB for MySQL clusters as an example.
-
Set the configuration mode to Script.
-
Enter the configuration script. The following examples show the script content.
Manage the permissions on the am-xxx instance:
{ "Version": "1", "Statement": [ { "Action": ["adb:DescribeDBClusters", "adb:ListTagResources"], "Resource": "acs:adb:*:*:dbcluster/*", "Effect": "Allow" }, { "Action": "adb:*", "Resource": ["acs:adb:*:*:dbcluster/am-xxx"], "Effect": "Allow" } ] }Read-only permissions on the am-xxx instance:
{ "Version": "1", "Statement": [ { "Action": ["adb:DescribeDBClusters", "adb:ListTagResources"], "Resource": "acs:adb:*:*:dbcluster/*", "Effect": "Allow" }, { "Action": "adb:Describe*", "Resource": ["acs:adb:*:*:dbcluster/am-xxx"], "Effect": "Allow" } ] }If a RAM user needs to manage or have read-only access to multiple clusters, add the corresponding cluster IDs to the
"Resource": ["acs:adb:*:*:dbcluster/am-xxx"]field in the script. For example,"Resource": ["acs:adb:*:*:dbcluster/am-xxx", "acs:adb:*:*:dbcluster/am-yyy"].After the custom policy is created, attach it to the corresponding RAM user.
-
Click OK.
-
Enter a policy name and description, and then click OK.
References
-
When you use AnalyticDB for MySQL Enterprise Edition, Basic Edition, and Data Lakehouse Edition, you can bind a RAM user to a database standard account to perform database development directly in the SQL editor or Spark editor of the AnalyticDB for MySQL console.
-
When a RAM user no longer needs certain permissions or leaves your organization, you can remove the permissions or disable or delete the RAM user.