When you use a Volcano Engine SDK to call an API, identity authentication using a Volcano Engine AccessKey pair is required. This topic introduces the identity authentication methods supported by a Volcano Engine SDK.
Each Volcano Engine account has a permanent AccessKey pair. The AccessKey pair is used for identity authentication when you call an API. The AccessKey pair of a Volcano Engine account has all resource permissions of all products. The leakage of the AccessKey pair may cause security risks and resource loss. When you use a Volcano Engine SDK to call an API, the AccessKey information may be leaked if you pass it to the initialization code and the code is leaked. This causes security risks.
We recommend that you use environment variables to specify the authentication information such as AccessKey to avoid hard-coded AccessKey information. After you configure environment variables, you can pass authentication parameters to the corresponding function dynamically without modifying code. This ensures secure, efficient identity authentication. For information on how to configure environment variables, refer to Configuration methods. When you configure environment variables, we recommend that you use the AccessKey pair of an IAM user. For security purposes, the IAM user must have the minimum required permissions. For more information, refer to Authentication types. This section describes how to configure environment variables for a Volcano Engine SDK.
tip
When using the Volcano Engine Python SDK, you should not add a protocol header (https:// or http://) in the VOLCENGINE_ENDPOINT configuration. For example, use tls-ap-southeast-1.ibytepluses.com.
When using the Volcano Engine C++ SDK, please do not set the request protocol header through other initialization parameters. Instead, set it uniformly through the VOLCENGINE_ENDPOINT parameter.
After you configure environment variables, the back-end service gets the values of the environment variables dynamically in the current session, and applies the values to the corresponding function. To modify authentication parameters such as the default AccessKey pair, modify the environment variables directly.
Run the following command to configure environment variables. For information on how to get authentication parameters, refer to Parameter description. After you configure environment variables, the back-end service gets the values of the environment variables dynamically in the current session, and applies the values to the corresponding function.
Use the following method to configure environment variables on Windows. For information on how to get authentication parameters, refer to Parameter description. - On Windows Command Prompt, run the following command to configure environment variables:
- On PowerShell, run the following command to configure environment variables:
- Open This PC. Right-click a blank area and click Properties.
- On the Advanced tab, click Environment Variables.
- In the System Variables area, add authentication-related environment variables and click OK.
- To modify authentication parameters such as the default AccessKey pair, change the values of the environment variables directly.
Configure authentication settings such as Volcano Engine AccessKey information in environment variables. We recommend that you use the AccessKey pair of an IAM user for identity authentication, or use an STS token to access TLS before the token expires.
Using an IAM AccessKey pair
Sample code of environment variables with an IAM AccessKey pair:
An IAM user can use its AccessKey pair to call the AssumeRole API action to get the permissions and STS token of an IAM role and use the token to access Volcano Engine resources before the token expires. For information on how to access TLS using STS, refer to Use Security Token Service to access Torch Log Service. Sample code of environment variables with an STS token: