Scenario | Capability Description | Applicable Module |
Scenario 1 | Supports connecting to SSM to obtain usernames, passwords, and other information when a data source is created | Project Management - Data Source Management |
Scenario 2 | Obtain secrets via dlcutils.secrets in Notebook code. | Studio - Notebook |
Scenario 3 | Obtain secrets via wedatautils.get_secret_value in Python tasks. | Orchestration Space - Python |
Data Source Type | Data source type | Encryption Target |
Relational databases | Tencent Cloud MySQL | Password |
| MySQL | Password |
| TCHouse-P | Password |
| Oracle | Password |
| PostgreSQL | Password |
| SQL Server | Password |
Big data | TCHouse-D | Password |
Semi-Structured | SFTP | Password (Password Authentication Mode) |
| COS | SecretKey |
| REST API | Password/Token/Client Secret |
| S3 | AccessKeySecret |
| Azure Blob | AccessKey / SAS Token |
Parameter | Description |
Secret Name | A custom credential identifier used for referencing in WeData, for example, mysql-prod-password. |
Secret Version | For example, v1 and 1.0, supporting multiple version control. |
Secret Content | Enter the sensitive information that needs to be encrypted, for example, a database password. |


Parameter | Description | Required |
SSM Region | Select the Tencent Cloud region where the credential is located, such as Guangzhou. | Yes |
Secret Name | Name of the secret created in SSM | Yes |
Secret Version | Secret version number, such as v1 | Yes |
dlcutils.secrets function to obtain secret values stored in SSM, avoiding writing sensitive information in plaintext in the code.dlcutils function library is applicable only to the DLC engine machine learning resource group - Spark MLlib type.dlcutils.secrets.get() function:# Obtain Secrets from SSMsecret_value = dlcutils.secrets.get(secretName="your_secret_name", # Secret namesecretVersion="v1", # Secret versionregion="ap-guangzhou" # Region, e.g., Guangzhou)# Print the resultprint(secret_value)
Parameter Name | Type | Required | Description |
secretName | string | Yes | Name of the secret, which is the key identifier defined in SSM |
secretVersion | string | Yes | Secret version number, such as v1 and 1.0 |
region | string | Yes | Region ID, such as ap-guangzhou (Guangzhou) and ap-shanghai (Shanghai) |
Scenario | Example code |
Obtaining Tencent Cloud API Keys | ak = dlcutils.secrets.get("my-ak", "v1", "ap-guangzhou")sk = dlcutils.secrets.get("my-sk", "v1", "ap-guangzhou") |
Obtaining Database Connection Passwords | password = dlcutils.secrets.get("db-password", "v1", "ap-guangzhou") |
Obtaining Third-Party API Tokens | api_token = dlcutils.secrets.get("api-token", "v1", "ap-guangzhou") |
wedatautils.get_secret_value function to obtain secret values stored in SSM.wedatautils.get_secret_value in the Python task code:import wedatautils# Configure the secret informationsecret_name = "your_secret_name" # Secret nameversion_id = "1.0" # Secret versionregion = "ap-guangzhou" # Region where the secret is located# Obtain the secret contentsecret_value = wedatautils.get_secret_value(secret_name,version_id,region)# Use the secretprint("this is " + secret_value)
Parameter Name | Type | Required | Description |
secret_name | string | Yes | Name of the secret created in SSM |
version_id | string | Yes | Secret version number, such as 1.0 and v1 |
region | string | Yes | Region ID, such as ap-guangzhou |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan