无法使用AWS .NET SDK获取amazon RDS实例

时间:2010-07-27 09:02:10

标签: mysql amazon-web-services cloud amazon-rds

我无法从本地计算机连接到RDS中的数据库....

这是我的代码:

Amazon.RDS.AmazonRDSClient client = new Amazon.RDS.AmazonRDSClient(myPublicKey, myPrivateKey);

Amazon.RDS.Model.DescribeDBInstancesRequest instanceRequest = new Amazon.RDS.Model.DescribeDBInstancesRequest();

Amazon.RDS.Model.DescribeDBInstancesResponse instanceResponse = new Amazon.RDS.Model.DescribeDBInstancesResponse();

instanceResponse = client.DescribeDBInstances(instanceRequest);

Amazon.RDS.Model.DBInstance instance = instanceResponse.DescribeDBInstancesResult.DBInstance[0];

DBInstance列表始终为空,即Count为0.而我知道我已经使用管理控制台创建了RDS实例并运行了。

此外,当我使用从RDS管理控制台获得的端点准备连接字符串时,我可以创建表格和所有。

我在安全组中提供了访问权限。

我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

我猜你的实例不在美国东部地区。

默认情况下,SDK连接到us-east。如果要连接到其他区域,则需要在AmazonRDSClient上指定它。

Amazon.RDS.AmazonRDSClient service = new Amazon.RDS.AmazonRDSClient(
  awsAccessKeyId,
  awsSecretAccessKey,
  new Amazon.RDS.AmazonRDSConfig().WithServiceURL(endpointUrl));

endpointUrl的可能值为:

  

https://rds.us-east-1.amazonaws.com(默认)

     

https://rds.us-west-1.amazonaws.com

     

https://rds.eu-west-1.amazonaws.com

     

https://rds.ap-southeast-1.amazonaws.com