Updated on 2024-03-21 GMT+08:00

AK/SK-based Authentication

This authentication method is available for OBS Management, Training Management, Model Management, and Service Management.

Sample Code

1
2
from modelarts.session import Session
session = Session(access_key='***',secret_key='***', project_id='***', region_name='***')

Parameters in this command are described as follows:

  • To obtain access_key and secret_key, follow these steps:
    1. Log in to the management console, hover over your username in the upper right corner and choose My Credentials. The My Credentials page is displayed.
    2. Choose Access Keys and click Create Access Key.
    3. In the Create Access Key dialog box, enter the description and click OK. Click Download to download the key. The access key file will be saved in the default download folder of the browser. Open the credentials.csv file to view the access key (Access Key Id and Secret Access Key).
  • project_id indicates the project ID. To obtain the project ID, do as follows:
    On the My Credentials page, click API Credentials. In the project list, view the project ID and name. If there are multiple projects, unfold the target region and obtain the project ID from the Project ID column.
    Figure 1 Viewing a project ID
  • region_name indicates the region ID. For details about how to obtain a region ID, see Obtaining Region Information.