Get an AccessKey

更新时间:
复制 MD 格式

All permissions on Alibaba Cloud are managed by Resource Access Management (RAM). As an Alibaba Cloud product, SOFAStack middleware also uses RAM for permission management. This topic describes how to obtain an AccessKey.

What is an AccessKey

An AccessKey is required to verify your identity when you call Alibaba Cloud APIs. An AccessKey consists of an AccessKey ID and an AccessKey secret, which must be used together.

  • AccessKey ID: Used to identify the user.

  • AccessKey secret: A key used to authenticate the user. The AccessKey secret must be kept confidential.

Prerequisites

You have created a RAM user. For instructions, see Create a RAM user.

Procedure

  1. Log on to the RAM console.

  2. In the navigation pane on the left, choose Identity Management > Users.

  3. On the Users page, click the name of the target RAM user.

  4. In the User AccessKey section, click Create AccessKey.

  5. Complete the security authentication as prompted.

  6. In the View Secret dialog box, view the AccessKey ID and AccessKey secret.

    Click Download CSV File to download the AccessKey information or click Copy to copy the information.

    Note
    • The AccessKey secret of a RAM user is displayed only when it is created. It cannot be retrieved later. Keep it confidential.

    • If an AccessKey is leaked or lost, create a new one. Each RAM user can have a maximum of two AccessKeys.

  7. Click OK.

Usage recommendations

To prevent unauthorized access when connecting to middleware, you must authenticate your application. Configure the AccessKey ID and AccessKey secret in the environment variables on the machine where your application runs.

Follow these steps:

  • Configuration for Linux and macOS

    Run the following commands:

    export SOFA_AK_ENV=<access_key_id>
    export SOFA_SK_ENV=<access_key_secret>

    Replace <access_key_id> with your AccessKey ID and <access_key_secret> with your AccessKey secret.

  • Configuration for Windows

    1. Create the SOFA_AK_ENV and SOFA_SK_ENV environment variables, and set their values to your AccessKey ID and AccessKey secret, respectively.

    2. Restart Windows.

Important
  • Do not use the AccessKey of your Alibaba Cloud account because a leak would threaten all your resources. Instead, use the AccessKey of a RAM user to reduce this risk.

  • In a production environment, create a separate RAM user for the middleware. This simplifies permission control and management.