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

发布于 2024-09-11 12:49:52 字数 756 浏览 5 评论 0原文

我无法从本地计算机连接到 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 列表始终为空,即计数为 0。而我知道我有 RDS实例已启动并正在运行,就像我使用管理控制台创建它们一样。

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

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

我错过了什么吗?

I'm not able to connect to my database in RDS from local machine....

Here is my code:

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];

The DBInstance list is always empty i.e. the Count is 0. Whereas I know that I have RDS instances UP and running as I have created them using the management console.

Also, when I prepare the connection string using the endpoint which I got from the RDS management console, I'm able to create table and all.

I have provided access in the security group.

Am I missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深空失忆 2024-09-18 12:49:52

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

默认情况下,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

Im going to guess that your instance is not in the us-east region.

By default the SDK connects to us-east. If you want to connect to another region, you need to specify it on the AmazonRDSClient.

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

Possible values for endpointUrl are:

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

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文