全部产品
存储与CDN 数据库 域名与网站(万网) 应用服务 数加·人工智能 数加·大数据基础服务 互联网中间件 视频服务 开发者工具 解决方案 物联网 钉钉智能硬件
阿里云SDK开发指南

云数据库RDS

更新时间:2018-02-22 14:07:58

本操作以RDS的CreateDBInstance接口为例,向您演示如何使用阿里云Python SDK调用RDS的API。

注意:运行该示例代码将创建RDS实例,并产生实际费用,请谨慎运行。

  1. from aliyunsdkcore.client import AcsClient
  2. from aliyunsdkrds.request.v20140815 import CreateDBInstanceRequest
  3. # 创建 AcsClient 实例
  4. client = AcsClient(
  5. "<your-access-key-id>",
  6. "<your-access-key-secret>",
  7. "<your-region-id>"
  8. );
  9. request = CreateDBInstanceRequest.CreateDBInstanceRequest()
  10. request.set_Engine = "MySQL"
  11. request.set_EngineVersion = "5.7"
  12. request.set_DBInstanceClass = "mysql.n1.micro.1"
  13. request.set_DBInstanceStorage = "20"
  14. request.set_DBInstanceNetType = "Intranet"
  15. request.set_SecurityIPList = "0.0.0.0/0"
  16. request.set_PayType = "Postpaid"
  17. request.set_DBInstanceDescription = "MyRds"
  18. request.set_ClientToken = "<uuid>"
  19. response = client.do_action_with_exception(request)
  20. print response
本文导读目录