Identity management

Updated at:

Unless it is strictly necessary, avoid using your Alibaba Cloud account (the root account) directly to access Function Compute. Instead, use a Resource Access Management (RAM) entity—a RAM user or RAM role—to keep your Alibaba Cloud account and cloud resources secure.

When to use RAM users versus RAM roles

Identity type Has long-term credentials Suitable for
RAM user Yes (a logon password or an AccessKey pair) Human operators and automated programs that need long-term credentials
RAM role No (temporary Security Token Service (STS) token only) Function code accessing other services, cross-account access, and federated identity

RAM users

A RAM user is a permanent identity that has long-term credentials (a logon password or an AccessKey pair). To create a RAM user, use an Alibaba Cloud account (the root account), or a RAM user or RAM role that has administrative rights. Once granted permissions, a RAM user can access Alibaba Cloud resources through the Alibaba Cloud Management Console or by calling API operations.

When creating a RAM user, select one or both of the following Access Mode options:

Access mode How it works When to use
Console Access Logs in with a username and password Human operators accessing the console
Using permanent AccessKey to access Makes API calls with an AccessKey pair Programs and automated processes
Both options The RAM user has both a logon password and an AccessKey pair Select both options only if the same RAM user must serve human and program use. Otherwise, keep human and program identities separate.

Security practices for RAM users

  • Start with an admin RAM user. Use your Alibaba Cloud account to create a RAM user with administrative rights first. Then use that RAM user to create and manage other RAM users.

  • Separate human and program identities. Create dedicated RAM users for individuals and separate RAM users for applications to limit the blast radius of unintended operations.

  • Enable MFA for console users. Multi-factor authentication (MFA) adds a second layer of verification for RAM users with console access. Alibaba Cloud progressively enforces MFA for RAM user console logins.

  • Apply least privilege. Grant only the permissions required to perform a specific task. Least-privilege permissions reduce the risk of permission abuse and limit exposure if credentials are compromised.

  • Never embed credentials in code. Hardcoding an AccessKey ID or AccessKey secret in your code risks exposing all resources under your account if the code is leaked. Use STS tokens or environment variables instead.

  • Enable SSO when applicable. Single sign-on (SSO) lets RAM users log in from your enterprise identity management system without managing separate Alibaba Cloud credentials.

Related topics

RAM user groups

Create a group when an account has multiple RAM users. Group users with the same responsibilities to simplify permission management and grant permissions in batches. All users in the same group share the same permissions, so you can grant or revoke access for an entire team with a single operation.

Security practices for RAM user groups

  • Apply least privilege at the group level, not per user.

  • When a user's role changes, remove them from the groups they no longer belong to, to prevent permission abuse.

  • Revoke permissions from the group when those permissions are no longer needed.

Related topics

RAM roles

A RAM role is a virtual identity that has policies attached but no long-term credentials (no logon password and no AccessKey pair). A trusted entity assumes the RAM role and receives temporary credentials (an STS token) to access Alibaba Cloud resources on behalf of that role.

This model is well-suited for:

  • Function Compute code accessing other Alibaba Cloud services. Attach a role to your function so it gets temporary credentials at runtime, without storing any keys in code.

  • Cross-account access. Grant an entity in another Alibaba Cloud account permissions to operate on resources in your account.

  • Federated identity. Allow users from an external identity provider to assume a role through SSO.

How it works

  1. Grant a trusted entity permission to call the AssumeRole operation.

  2. The trusted entity calls AssumeRole and receives a short-lived STS token.

  3. The trusted entity uses the STS token to access resources as the RAM role.

  4. The STS token expires after the configured validity period.

Note: The maximum validity period of an STS token equals the maximum session duration set for the RAM role. The maximum session duration is measured in seconds, ranges from 3,600 to 43,200 seconds, and defaults to 3,600 seconds. Set the shortest duration that your workloads tolerate to reduce security risks.

Security practices for RAM roles

  • Set a short STS token validity period. Shorter-lived tokens reduce exposure if a token is compromised.

  • Avoid changing the trusted entity after creation. Changing the trusted entity can cause permission loss that affects your workloads. Adding a new trusted entity may introduce privilege escalation risks. If the change is unavoidable, verify it thoroughly in a test account before you apply it to a production account.

  • Enable SSO when applicable. SSO lets users in your enterprise identity management system assume RAM roles without managing separate credentials.

Related topics

References