gpt4 book ai didi

java - 亚马逊 RDS : Launching "db.t1.micro" instances using the JAVA SDK

转载 作者:行者123 更新时间:2023-12-02 03:30:36 25 4
gpt4 key购买 nike

我尝试使用 Java API 和以下代码在 Amazon RDS 上启动新的 MySql 实例:

CreateDBInstanceRequest createDBInstanceRequest = new CreateDBInstanceRequest();
createDBInstanceRequest.setEngine("MySQL");
createDBInstanceRequest.setLicenseModel("general-public-license");
createDBInstanceRequest.setEngineVersion("5.5.25a");
createDBInstanceRequest.setDBInstanceClass("db.t1.micro");
createDBInstanceRequest.setMultiAZ(false);
createDBInstanceRequest.setAutoMinorVersionUpgrade(true);
createDBInstanceRequest.setAllocatedStorage(5);
createDBInstanceRequest.setDBInstanceIdentifier("mydbinstance");
createDBInstanceRequest.setMasterUsername("master");
createDBInstanceRequest.setMasterUserPassword("password");
createDBInstanceRequest.setDBName("dbname");
createDBInstanceRequest.setPort(3306);
createDBInstanceRequest.setDBParameterGroupName("default.mysql5.5");
createDBInstanceRequest.setDBSubnetGroupName("dev");
createDBInstanceRequest.setBackupRetentionPeriod(1);
DBInstance dbInstance = RDS.createDBInstance(createDBInstanceRequest);

问题是这总是会导致以下错误:

AWS Error Code: InsufficientDBInstanceCapacity, AWS Error Message: Cannot create a database instance because there is no availability zone with sufficient capacity. Please try your request again at a later time.

按照建议,我稍后尝试过,但始终无法以编程方式启动新实例,但当我尝试使用 Amazon Mgmt 控制台启动实例时,使用完全相同的参数,它会立即启动。

我还注意到,此问题仅发生在数据库实例类“db.t1.micro”上。该实例类无法通过 API 获得吗?

最佳答案

您确定您所在区域的任何可用区都提供此版本的 MySQL 吗?

我建议执行DescribeOrderableDBInstanceOptions首先针对您选择的引擎,使用您自己的标准进行过滤(例如 DBInstanceClass="db.t1.micro"),然后从中选择版本。

关于java - 亚马逊 RDS : Launching "db.t1.micro" instances using the JAVA SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12482598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com