Updated on 2023-11-21 GMT+08:00

ma-cli Authentication

Overview

  • VMs and personal computers require the configuration of authentication. Both a username and password (default) and an AK/SK can be used for authentication.
  • When using an account for authentication, specify a username and password. When using an IAM account for authentication, specify an account, username, and password.
  • In ModelArts notebook, you do not need to manually configure authentication because an agency is used for authentication by default.
  • If you have configured authentication in ModelArts notebook, the specified authentication is preferentially used.

    To ensure the security of your sensitive information, it is important to prevent any potential leakage during authentication.

CLI Parameters

$ ma-cli configure -h
Usage: ma-cli configure [OPTIONS]

Options:
  -auth, --auth [PWD|AKSK|ROMA]  Authentication type.
  -rp, --region-profile PATH     ModelArts region file path.
  -a, --account TEXT             Account of an IAM user.
  -u, --username TEXT            Username of an IAM user.
  -p, --password TEXT            Password of an IAM user
  -ak, --access-key TEXT         User access key.
  -sk, --secret-key TEXT         User secret key.
  -r, --region TEXT              The region you want to visit.
  -pi, --project-id TEXT         User project id.
  -C, --config-file TEXT         Configure file path for authorization.
  -D, --debug                    Debug Mode. Shows full stack trace when error occurs.
  -P, --profile TEXT             CLI connection profile to use. The default profile is "DEFAULT".
  -h, -H, --help                 Show this message and exit.
Table 1 Authentication CLI parameters

Parameter

Type

Mandatory

Description

-auth / --auth

String

No

Authentication mode, which can be PWD (username and password) or AKSK (AK/SK). The default value is PWD.

-rp / --region-profile

String

No

ModelArts region configuration file

-a / --account

String

No

IAM tenant account, which needs to be specified when authentication using an IAM account is used. It is required in authentication using a username and password.

-u / --username

String

No

Username, which is a username or an IAM username for authentication using an account or an IAM account. It is required in authentication using a username and password.

-p / --password

String

No

Password, which is required in authentication using a username and password

-ak / --access-key

String

No

Access key, which is required in authentication using an AK/SK

-sk / --secret-key

String

No

Secret key, which is required in authentication using an AK/SK

-r / --region

String

No

Region name. If this parameter is left blank, the value of the REGION_NAME environment variable will be used by default.

-pi / --project-id

String

No

Project ID. If this parameter is left blank, the region value (default) or the value of the PROJECT_ID environment variable will be used.

-P / --profile

String

No

Authentication configuration, which defaults to DEFAULT

-C / --config-file

String

No

Local path to the configuration file, which defaults to ~/.modelarts/ma-cli-profile.yaml

Authentication Using Username and Password

The following describes how to use the ma-cli configure command on a VM to configure authentication using the user name and password.

In the following example, any string with ${} is a variable. You can specify a value.

For example, ${your_password} indicates that you need to type your password.

# The DEFAULT authentication configuration is used by default. You need to type the account, username, and password one by one. If the account and username are not required, press Enter to skip them.
$ ma-cli configure --auth PWD --region ${your_region}
account: ${your_account}
username: ${your_username}
password: ${your_password} # The input is not displayed on the console.

Authentication Using an AK/SK

This command uses an AK/SK for authentication, which means you have to enter them interactively. Your AK/SK will not be visible on the console.

In the following example, any string with ${} is a variable. You can specify a value.

For example, you need to replace ${access key} with your access key.

ma-cli configure --auth AKSK
access key [***]: ${access key}
secret key [***]: ${secret key}

After the authentication command is executed, the authentication information will be saved in the ~/.modelarts/ma-cli-profile.yaml configuration file.