Using your Alibaba Cloud account directly to access Key Management Service (KMS) exposes all resources under that account to credential compromise — a single leaked key affects everything. Instead, access KMS through Resource Access Management (RAM) users or RAM roles: identities designed for controlled, auditable access.
Choose an identity type
| Identity type | Has permanent credentials | Best for | Credential type |
|---|---|---|---|
| RAM user | Yes (logon password or AccessKey pair) | Individual people (console or API access) | Static |
| RAM user group | No (groups hold policies, not credentials) | Grouping people for shared permissions | N/A |
| RAM role | No | Programs, services, and cross-account access | STS token (temporary) |
RAM users
RAM users are for individual people who need to access KMS — either through the Alibaba Cloud Management Console or via API. RAM users can be created by Alibaba Cloud accounts or by RAM users and RAM roles that have administrative rights.
When creating a RAM user, set the Access Mode:
Console Access — the user logs in with a username and logon password.
Using permanent AccessKey to access — the user makes API calls with an AccessKey pair.
Both — grants both access modes.
Keep console users and API users separate to prevent accidental operations from affecting programmatic workflows.
Security checklist for RAM users:
Grant only the permissions needed for the task (least privilege).
Enable multi-factor authentication (MFA) for any RAM user with console access.
Never embed an AccessKey ID or AccessKey secret directly in code. Store credentials in environment variables or use Security Token Service (STS) tokens instead.
Enable single sign-on (SSO) if your organization uses a corporate identity provider.
Lifecycle guidance for privileged RAM users
Use your Alibaba Cloud account to create one RAM user with administrative rights. Use that RAM user — not the account itself — for day-to-day management tasks. After initial setup is complete, stop using the root account for routine access.
Related topics
RAM user groups
RAM user groups let you apply the same permissions to multiple RAM users at once, reducing the overhead of managing permissions individually.
Best practices:
Apply least-privilege permissions to the group, not to individual members.
Remove a RAM user from the group when their role changes.
Revoke group permissions when the group no longer needs them.
Related topics
RAM roles
A RAM role is a virtual identity with no permanent credentials — no logon password, no AccessKey pair. Instead, a trusted entity assumes the role and receives a temporary Security Token Service (STS) token scoped to that session.
How it works:
Grant a trusted entity permission to call the AssumeRole operation.
The trusted entity calls
AssumeRoleand receives an STS token.The trusted entity uses the STS token to access KMS as the RAM role.
The STS token expires after the session duration ends.
Security checklist for RAM roles:
Avoid changing the trusted entity of a role after creation. Removing a trusted entity causes permission loss; adding one may create privilege escalation risks. Test all changes before applying them.
Set the maximum session duration to an appropriate value to reduce security risks. The STS token validity period cannot exceed the role's maximum session duration.
Enable SSO for RAM roles if your organization uses a corporate identity provider.