Aliyun RDS SDK for Python

raw JSON →
2.7.53 verified Fri May 01 auth: no python

Aliyun RDS SDK for Python is the official Alibaba Cloud SDK module for managing ApsaraDB RDS (Relational Database Service). Current version is 2.7.53, released monthly or as needed. It provides APIs to create, configure, and monitor RDS instances, including MySQL, SQL Server, PostgreSQL, and MariaDB.

pip install aliyun-python-sdk-rds
error ModuleNotFoundError: No module named 'aliyunsdkrds'
cause Package not installed or environment path issue.
fix
Install with 'pip install aliyun-python-sdk-rds'.
error AttributeError: module 'aliyunsdkrds.request' has no attribute 'v20140815'
cause Incorrect import path or package version too old.
fix
Ensure aliyun-python-sdk-rds >= 2.0.0, import as 'from aliyunsdkrds.request.v20140815 import ...'
error aliyunsdkcore.exception.ServerException: HTTP Status: 400 Error: InvalidRegionId.RegionId
cause Invalid or missing region ID in AcsClient.
fix
Provide a valid region ID like 'cn-hangzhou'.
error TypeError: 'AcsClient' object is not callable
cause Calling client() instead of client.do_action_with_exception().
fix
Use 'response = client.do_action_with_exception(request)'.
deprecated The old import from 'aliyun.api' or 'rds' module is deprecated. Use versioned requests from aliyunsdkrds.request.
fix Use 'from aliyunsdkrds.request.v20140815 import ...' instead.
breaking The SDK requires Python 2.7+ or Python 3.4+ but Python 2 support was dropped in later core versions. For Python 3, ensure aliyun-python-sdk-core>=2.13.0.
fix Use Python 3.6+ and install the latest aliyun-python-sdk-core.
gotcha Region ID must be specified when creating AcsClient; default region not set. Missing region leads to 'RequestId: ...' errors.
fix Always provide a valid region ID, e.g., 'cn-hangzhou'.
gotcha Request classes are not instantiated with parameters; you must use set_* methods. Common mistake: passing parameters to constructor.
fix Instantiate request with no args, then call set_* methods like .set_DBInstanceId('xxx').

List all RDS instances in the 'cn-hangzhou' region.

from aliyunsdkcore.client import AcsClient
from aliyunsdkrds.request.v20140815 import DescribeDBInstancesRequest
import json

# Use environment variables or hardcode for testing (not production)
client = AcsClient(
    os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', 'your-access-key-id'),
    os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', 'your-access-key-secret'),
    'cn-hangzhou'
)
request = DescribeDBInstancesRequest.DescribeDBInstancesRequest()
response = client.do_action_with_exception(request)
print(json.loads(response))