All Products
Search
Document Center

Hologres:RAM Role Authorization Mode

Last Updated:Mar 20, 2026

RAM role authorization lets enterprise users access Hologres by assuming a Resource Access Management (RAM) role instead of using long-lived AccessKey credentials. The RAM role—not the underlying user account—becomes the Hologres member, and permissions are scoped to that role.

This guide covers the three steps to configure RAM role authorization and connect to Hologres.

Who this guide is for

AudiencePath
Cloud account administrators granting internal RAM users access through role assumptionPath A
Enterprise IT administrators configuring SAML 2.0 federation with external identity providers (IdPs) such as Active Directory or OktaPath B
Application developers connecting to Hologres via JDBC or psql with Security Token Service (STS) temporary credentialsStep 3

When to use RAM role authorization

MethodBest forCredential type
Alibaba Cloud account or RAM user (password)Individual users accessing the consoleLong-lived account credentials
RAM role (this guide)Enterprise single sign-on (SSO) / federated identity / applications that must not store static keysShort-lived STS temporary credentials
ECS instance RAM roleApplications running on ECS that need automatic credential rotationAutomatic, no code required

How it works

RAM role authorization is built on Alibaba Cloud Security Token Service (STS). When a user or application assumes a RAM role, STS issues three short-lived credential components: AccessKeyId (AccessKey ID), AccessKeySecret (AccessKey secret), and SecurityToken—that are valid for a configurable duration. Hologres accepts these credentials in place of permanent account credentials.

Benefits of STS temporary credentials:

  • Reduced exposure risk: Credentials are short-lived and never need to be stored permanently.

  • Automatic revocation: Credentials expire automatically when the validity period ends, eliminating manual permission-revocation steps.

  • Flexible access control: Validity period and permission scope are configurable per request.

Supported clients and version requirements

ClientSupportedMinimum version
Hologres consoleYesAny
HoloWebYesAny
JDBCYesHologres V2.0
psqlYesHologres V2.0
Important

Verify your Hologres instance version before using JDBC or psql with STS credentials.

How Hologres treats RAM roles

In Hologres, RAM roles and Alibaba Cloud accounts (root accounts and RAM users) are treated as equals. A RAM role is a standard logon account. A superuser must grant permissions—such as SELECT, INSERT, and UPDATE—directly to the RAM role, not to the underlying Alibaba Cloud account. The RAM role then accesses Hologres within the scope of those granted permissions.

Prerequisites

Before you begin, ensure that you have:

  • RAM console access with permission to Create Role and Attach Role Policy (for Step 1)

  • Hologres instance superuser access (for Step 2)

  • (Path B only) Permission to register a SAML provider in the RAM console

Setup overview

Configuring RAM role authorization involves three steps:

  1. Create a RAM role – Choose Path A (RAM user) or Path B (IdP user) based on who authenticates.

  2. Add the RAM role to a Hologres instance and grant permissions – The Alibaba Cloud account owner grants the role access to a specific instance.

  3. Connect to Hologres – Connect via the console, JDBC, or psql.

Step 1: Create a RAM role

Two paths are available depending on the identity type of the user who will assume the role:

DimensionPath A – RAM user (cloud account)Path B – IdP user (identity provider)
Who authenticatesRAM user within Alibaba CloudExternal IdP user (Active Directory, Okta, etc.)
Federation protocolNone (RAM-to-RAM role switch)SAML 2.0
Hologres member identityRAM role ARNRAM role ARN
Additional RAM setupGrant AliyunSTSAssumeRoleAccess to the RAM userRegister a SAML provider in RAM
Best forInternal Alibaba Cloud usersEnterprise SSO / external employees

For a conceptual overview of RAM roles, see RAM role overview.

Path A: Grant access to a RAM user (cloud account)

Performed by: Alibaba Cloud account owner

Use this path when a RAM user within your Alibaba Cloud account needs to assume a RAM role to access Hologres.

Prerequisites

Before you begin, ensure that you have:

  • An Alibaba Cloud account with permission to create RAM roles

  • A RAM user (existing or to be created) who will assume the role

  • Your Alibaba Cloud account ID, available on the User Information page

Create a RAM role for a trusted Alibaba Cloud account

  1. Log on to the RAM console. In the left navigation pane, click Identities > Roles.

  2. On the Roles page, click Create Role. Set Principal Type to Cloud Account and Principal Name to Current Account. Click OK.

  3. In the Create Role dialog box, enter a Role Name and click OK.

Configure the trust policy

  1. On the RAM Roles page, click the target role name to open its details page.

  2. On the Trust Policy tab, click Edit Trust Policy. Replace the policy content with the following JSON. Replace Alibaba Cloud account ID in acs:ram::Alibaba Cloud account ID:root with your actual account ID.

    Trust policy field reference:

    FieldDescription
    Principal.RAMThe Alibaba Cloud account (or RAM user) permitted to assume this role. Set to acs:ram::Alibaba Cloud account ID:root to allow all RAM users in the account.
    Principal.ServiceAlibaba Cloud services permitted to assume this role. dataworks.aliyuncs.com enables DataWorks to use this role.
    VersionPolicy schema version. Must be "1".
       {
         "Statement": [
           {
             "Action": "sts:AssumeRole",
             "Effect": "Allow",
             "Principal": {
               "RAM": [
                 "acs:ram::Alibaba Cloud account ID:root"
               ]
             }
           },
           {
             "Action": "sts:AssumeRole",
             "Effect": "Allow",
             "Principal": {
               "Service": [
                 "dataworks.aliyuncs.com"
               ]
             }
           }
         ],
         "Version": "1"
       }

Grant the RAM user permission to call AssumeRole

The RAM user who will assume the role must have the AliyunSTSAssumeRoleAccess system policy attached. Without this policy, the user cannot call the STS AssumeRole API.

In the RAM console, navigate to the RAM user, click Add Permissions, and attach the AliyunSTSAssumeRoleAccess policy. For step-by-step instructions, see Grant permissions to a RAM user.

Obtain STS temporary security credentials

The RAM user calls the AssumeRole API operation to obtain short-lived credentials. For SDK examples, see Use the STS OpenAPI example.

Save the returned AccessKeyId, AccessKeySecret, and SecurityToken values — you will use them in Step 3.

Path B: Grant access to an IdP user (identity provider)

Performed by: Alibaba Cloud account owner

Use this path when on-premises identity provider (IdP) users authenticate via SAML 2.0 federation and need to assume a RAM role automatically.

Prerequisites

Before you begin, ensure that you have:

How SAML-based role SSO works

The following diagram shows the authentication flow for Path B:

RAM role SSO flow

The end-to-end flow:

  1. A user opens a browser and selects Alibaba Cloud as the target service on the IdP logon page (for example, Microsoft Active Directory Federation Services (AD FS) at https://ADFSServiceName/adfs/ls/IdpInitiatedSignOn.aspx).

    Some IdPs require users to log on before selecting the SSO application that represents Alibaba Cloud.
  2. The IdP generates a Security Assertion Markup Language (SAML) response and returns it to the browser.

  3. The browser forwards the SAML response to the Alibaba Cloud SSO service.

  4. The SSO service exchanges the SAML response for STS temporary security credentials and generates a console logon URL.

    If the SAML response maps to multiple RAM roles, the system prompts the user to select a role before proceeding.
  5. The SSO service returns the logon URL to the browser.

  6. The browser redirects to the URL. The user is now logged on to the Alibaba Cloud Management Console as the RAM role and can access the Hologres instance within the permissions granted to that role.

Create a RAM role for a trusted identity provider

  1. Log on to the RAM console. In the left navigation pane, click Identities > Roles.

  2. On the Roles page, click Create Role. Set Principal Type to Identity Provider.

  3. Click OK. In the dialog box, enter a role name.

  4. Set IdP Type and Select IdP, review the conditions, and click OK. The role is created.

Configure the trust policy

  1. On the Roles page, click the target role name to open its details page.

  2. On the Trust Policy tab, click Edit Trust Policy. Replace the policy content with the following JSON. Replace Alibaba Cloud account ID with your actual account ID, and replace IDP with the name of your SAML provider as registered in the RAM console.

    In the ARN string acs:ram::Alibaba Cloud account ID:saml-provider/IDP, the value IDP is a placeholder for your SAML provider name (a user-defined string), not the abbreviation "IdP" (identity provider).

    Trust policy field reference:

    FieldDescription
    saml:recipientThe SAML SSO endpoint. Must be exactly https://signin.aliyun.com/saml-role/sso.
    Principal.FederatedThe registered SAML provider ARN. Replace Alibaba Cloud account ID with your account ID and IDP with your SAML provider name.
    Principal.ServiceAlibaba Cloud services permitted to assume this role. dataworks.aliyuncs.com enables DataWorks to use this role.
    VersionPolicy schema version. Must be "1".
       {
         "Statement": [
           {
             "Action": "sts:AssumeRole",
             "Condition": {
               "StringEquals": {
                 "saml:recipient": "https://signin.aliyun.com/saml-role/sso"
               }
             },
             "Effect": "Allow",
             "Principal": {
               "Federated": [
                 "acs:ram::Alibaba Cloud account ID:saml-provider/IDP"
               ]
             }
           },
           {
             "Action": "sts:AssumeRole",
             "Effect": "Allow",
             "Principal": {
               "Service": [
                 "dataworks.aliyuncs.com"
               ]
             }
           }
         ],
         "Version": "1"
       }

Step 2: Add the RAM role to a Hologres instance and grant permissions

Performed by: Alibaba Cloud account owner (Hologres instance superuser)

Prerequisites

Before you begin, ensure that you have:

  • Completed Step 1 and obtained the RAM role ARN

  • Superuser access to the target Hologres instance

By default, a RAM role cannot view or manage instances in the Hologres console. The Alibaba Cloud account must first grant the necessary console permissions to the RAM role. For details, see Grant permissions to a RAM user.

After granting console access, add the RAM role to the Hologres instance and grant database permissions using one of the following options.

Option 1 – Hologres console (HoloWeb)

  1. Log on to the Hologres console.

  2. On the Instances page, click the target instance name. In the secondary panel, click Account Management to open the User Management page in HoloWeb.

  3. Click Add User. In the Add User dialog box, select the target RAM role and add it to the instance.

  4. On the Database Authorization page, grant the required permissions to the RAM role.

Option 2 – SQL statements

Grant permissions using SQL statements. For details, see Permission management overview.

Note (Path A only): If a RAM user assumes a RAM role, the role does not have Hologres console access by default. To enable console access, grant the AliyunRAMReadOnlyAccess permission to the RAM user in the RAM console. For details, see Grant permissions to a RAM user.

Step 3: Connect to Hologres

Console and HoloWeb

Performed by: RAM role user

Prerequisites

Before you begin, ensure that you have:

  • Completed Steps 1 and 2

  • (Path A only) The RAM user has the AliyunRAMReadOnlyAccess permission

Connect via the console

  1. Log on to the Hologres console using the RAM role identity to manage instances.

  2. In the left navigation pane, click Go To HoloWeb. For details on schema design and data development, see Connect to HoloWeb and execute a query.

JDBC and psql

Performed by: Application developer or RAM role user

Important

JDBC and psql connections using STS credentials require Hologres V2.0 or later. Verify your instance version before proceeding.

Prerequisites

Before you begin, ensure that you have:

  • Completed Steps 1 and 2

  • Called the AssumeRole API operation to obtain STS temporary security credentials: AccessKeyId, AccessKeySecret, and SecurityToken

  • The Hologres instance endpoint (<host>), port (<port>), and database name (<database>), available in the Hologres console under Instances > Connection Info

Set credentials as environment variables

The following is a sample STS temporary credentials response:

"Credentials": {
    "SecurityToken": "CAISuwJ1q6Ft5B2yu****KiAA",
    "AccessKeyId": "STS.NTKaenSkmLhG4HpM5****76UV",
    "AccessKeySecret": "6itECZnhbG2RU6ktTSBSd6JxeLHKPWyBt****SS62",
    "Expiration": "2025-02-21T03:47:07Z"
}

Set the values from Credentials.AccessKeyId, Credentials.AccessKeySecret, and Credentials.SecurityToken as environment variables:

export ALIBABA_CLOUD_ACCESS_KEY_ID="<value of Credentials.AccessKeyId>"
export ALIBABA_CLOUD_ACCESS_KEY_SECRET="<value of Credentials.AccessKeySecret>"
export ALIBABA_CLOUD_SECURITY_TOKEN="<value of Credentials.SecurityToken>"
Security best practices: - Never hardcode STS credentials in source code or configuration files. - Set credentials as environment variables or use a secrets manager. - STS credentials expire automatically (see Expiration in the response). Implement logic to refresh credentials before expiry by calling AssumeRole again. - Grant the minimum permissions required. Avoid AdministratorAccess in the RAM role policy. - Audit access using Alibaba Cloud ActionTrail. Never log credential values.

Connect using JDBC (Java)

All examples read STS credentials from environment variables and pass the security token through the JDBC connection.

For the full JDBC configuration reference, see Connect to Hologres using JDBC.

Method 1: Pass the security token via `PGProperty.OPTIONS`

Use this method when your connection framework does not accept query parameters in the URL, or when you want to supply all credentials through a Properties object.

import org.postgresql.PGProperty;
import java.sql.*;
import java.io.IOException;
import java.util.Properties;

public class JdbcLinkHologres1 {
    public static void main(String[] args) throws IOException, ClassNotFoundException, SQLException {
        // Read credentials from environment variables — do not hardcode
        String accessKeyId = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID");
        String accessKeySecret = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
        String securityToken = System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN");
        String url = "jdbc:postgresql://<host>:<port>/<database>";

        Properties props = new Properties();
        PGProperty.USER.set(props, accessKeyId);
        PGProperty.PASSWORD.set(props, accessKeySecret);
        PGProperty.OPTIONS.set(props, "sts_token=" + securityToken);

        Class.forName("org.postgresql.Driver");
        Connection connection = DriverManager.getConnection(url, props);

        Statement statement = connection.createStatement();
        ResultSet resultSet = statement.executeQuery("SELECT * FROM tabletest");

        while (resultSet.next()) {
            System.out.println("Result: " + resultSet.getInt(1));
            System.out.println("Result: " + resultSet.getString(2));
        }
    }
}

Parameter reference – Method 1:

PlaceholderDescriptionWhere to find it
ALIBABA_CLOUD_ACCESS_KEY_IDEnvironment variable holding the STS AccessKey IDSet from Credentials.AccessKeyId in the AssumeRole response
ALIBABA_CLOUD_ACCESS_KEY_SECRETEnvironment variable holding the STS AccessKey secretSet from Credentials.AccessKeySecret in the AssumeRole response
ALIBABA_CLOUD_SECURITY_TOKENEnvironment variable holding the STS security tokenSet from Credentials.SecurityToken in the AssumeRole response
<host>Hologres instance endpointHologres console > Instances > Connection Info
<port>Instance portHologres console > Instances > Connection Info
<database>Target database nameHoloWeb > Databases

Method 2: Append the security token to the JDBC URL

Use this method when your connection framework requires the full connection string in URL format. URL-encode the SecurityToken value before appending it.

import java.net.URLEncoder;
import java.sql.*;
import java.io.IOException;

public class JdbcLinkHologres2 {
    public static void main(String[] args) throws IOException, ClassNotFoundException, SQLException {
        // Read credentials from environment variables — do not hardcode
        String accessKeyId = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID");
        String accessKeySecret = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
        String securityToken = System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN");

        String url = "jdbc:postgresql://<host>:<port>/<database>";
        // URL-encode the security token before appending it as a query parameter
        String urlWithOptions = url + "?options=sts_token=" + URLEncoder.encode(securityToken, "UTF-8");

        Class.forName("org.postgresql.Driver");
        Connection connection = DriverManager.getConnection(urlWithOptions, accessKeyId, accessKeySecret);

        Statement statement = connection.createStatement();
        ResultSet resultSet = statement.executeQuery("SELECT * FROM tabletest");

        while (resultSet.next()) {
            System.out.println("Result: " + resultSet.getInt(1));
            System.out.println("Result: " + resultSet.getString(2));
        }
    }
}

Parameter reference – Method 2:

PlaceholderDescriptionWhere to find it
ALIBABA_CLOUD_ACCESS_KEY_IDEnvironment variable holding the STS AccessKey IDSet from Credentials.AccessKeyId in the AssumeRole response
ALIBABA_CLOUD_ACCESS_KEY_SECRETEnvironment variable holding the STS AccessKey secretSet from Credentials.AccessKeySecret in the AssumeRole response
ALIBABA_CLOUD_SECURITY_TOKENEnvironment variable holding the STS security token (must be URL-encoded)Set from Credentials.SecurityToken in the AssumeRole response
<host>Hologres instance endpointHologres console > Instances > Connection Info
<port>Instance portHologres console > Instances > Connection Info
<database>Target database nameHoloWeb > Databases

Connect using psql (command line)

This command passes STS credentials as environment variables and the security token via PGOPTIONS. For Linux systems. For details, see Connect to Hologres using a psql client.

PGUSER=<AccessKeyId> \
PGPASSWORD=<AccessKeySecret> \
PGOPTIONS="sts_token=<SecurityToken>" \
  psql -h <host> -p <port> -d <database>

Parameter reference:

PlaceholderDescriptionWhere to find it
<AccessKeyId>STS temporary AccessKey IDCredentials.AccessKeyId in the AssumeRole response
<AccessKeySecret>STS temporary AccessKey secretCredentials.AccessKeySecret in the AssumeRole response
<SecurityToken>STS security tokenCredentials.SecurityToken in the AssumeRole response
<host>Hologres instance endpointHologres console > Instances > Connection Info
<port>Instance portHologres console > Instances > Connection Info
<database>Target database nameHoloWeb > Databases

Verify your setup

After connecting, run the following query to confirm you are authenticated as the expected RAM role:

SELECT current_user;

The result returns the RAM role name you added to the Hologres instance in Step 2.

Troubleshooting

Error messageLikely causeResolution
password authentication failed for user "<AccessKeyId>"RAM role has not been added to the Hologres instanceComplete Step 2 to add the RAM role via User Management in HoloWeb.
password authentication failed for user "<AccessKeyId>"Security token not URL-encoded (JDBC Method 2 or psql)URL-encode the SecurityToken value using URLEncoder.encode before appending to the URL or PGOPTIONS.
password authentication failed for user "<AccessKeyId>"Credentials are incorrect or expiredConfirm AccessKeyId, AccessKeySecret, and SecurityToken are accurate. Call AssumeRole again to obtain fresh credentials if they have expired.

If none of the above resolves the issue, check Alibaba Cloud ActionTrail logs for the full call chain to identify the root cause.

What's next