edit-icon download-icon

ApsaraDB for RDS

Last Updated: Mar 20, 2018

ApsaraDB for RDS (Relational Database Service) is a stable and reliable online database service that supports the elastic scaling function. ApsaraDB for RDS is based on the Apsara distributed system and high-performance storage of ephemeral SSD and supports MySQL, SQL Server, and PostgreSQL engines. ApsaraDB for RDS offers a complete set of solutions for backup, recovery, monitoring, migration, disaster recovery, and troubleshooting database operation and maintenance. For more information, see ApsaraDB for RDS.

This tutorial uses the CreateDBInstance API of ApsaraDB RDS to show you how to use Alibaba Cloud C++ SDK to create an ApsaraDB for RDS instance.

Note: Running the code in this example will create an ApsaraDB RDS instance and generate fees.

  1. #include <iostream>
  2. #include <alibabacloud/core/AlibabaCloud.h>
  3. #include <alibabacloud/rds/RdsClient.h>
  4. using namespace AlibabaCloud;
  5. using namespace AlibabaCloud::Rds;
  6. int main(int argc, char** argv)
  7. {
  8. // Initialize the SDK
  9. AlibabaCloud::InitializeSdk();
  10. // Create a client instance
  11. ClientConfiguration configuration("<your-region-id>");
  12. RdsClient client("<your-access-key-id>", "<your-access-key-secret>", configuration);
  13. // Create a request and set parameters
  14. Model::CreateDBInstanceRequest request;
  15. request.setRegionId("cn-hangzhou");
  16. request.setEngine("MySQL");
  17. request.setEngineVersion("5.6");
  18. request.setDBInstanceClass("rds.mys2.small");
  19. request.setDBInstanceStorage(5);
  20. request.setDBInstanceNetType("Internet");
  21. request.setSecurityIPList("");
  22. request.setPayType("Postpaid");
  23. request.setClientToken("ETnLKlblzczshOTUbOCziJZNwHlYBQ");
  24. // Initiate the request and print the handling result
  25. auto outcome = client.createDBInstance(request);
  26. if(outcome.isSuccess())
  27. std::cout << "DBInstanceId: " << outcome.result().getDBInstanceId() << std::endl;
  28. // Close the SDK
  29. AlibabaCloud::ShutdownSdk();
  30. return 0;
  31. }
Thank you! We've received your feedback.