要创建具有特定版本的AWS RDS实例吗?

时间:2018-12-21 21:08:56

标签: .net wpf amazon-web-services amazon-rds aws-sdk-net

我正在尝试创建一个AWS RDS数据库。任何引擎都可以。

rdsClient = new Amazon.RDS.AmazonRDSClient(<aws_credentials>, <some_region>);

try
{
    rdsClient.CreateDBInstance(new CreateDBInstanceRequest(identifier, allocatedStorage, instanceSize, engine, username, password));
    MessageBox.Show(String.Format("{0} was succesfully created!", identifier));
}
catch (AmazonRDSException ex)
{
    MessageBox.Show(ex.Message);
}

因此,我正在将凭据加载到RDS客户端中,并尝试创建数据库。除我无法指定数据库版本外,此方法均工作正常。有没有其他创建数据库或指定版本的方法?

1 个答案:

答案 0 :(得分:2)

我还没有尝试过,但是我想您会想做类似的事情(下面的大写字母肯定是错误的):

var dbr = new CreateDBInstanceRequest();

   dpr.EngineVersion = <yourvalue>;
   dbr.Identifier = <yourvalue>;
   dbr.AllocatedStorage = <yourvalue>;
   dbr.InstanceSize = <yourvalue>;
   dbr.Engine = <yourvalue>;
   dbr.Username = <yourvalue>;
   dbr.Password = <yourvalue>;
   //also set any other values

 try
        {
            rdsClient.CreateDBInstance(dbr);
            MessageBox.Show(String.Format("{0} was succesfully created!", identifier));
        }
        catch (AmazonRDSException ex)
        {
            MessageBox.Show(ex.Message);
        }

https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Services/RDS/Generated/Model/CreateDBInstanceRequest.cs