在 C# 中创建 Amazon SQS 时设置区域

发布于 2024-09-30 10:45:17 字数 115 浏览 1 评论 0原文

我对云计算世界(包括亚马逊网络服务)非常陌生,所以我有一个非常简单的问题:

  • 创建亚马逊 sqs 时如何设置它的区域?默认区域是“美国西部(北加州)”。

谢谢!

I am very new in cloud computing world(including Amazon Web Service), so I have a very simple question:

  • How do I set the region of a amazon sqs when I create it? The default region is "US-West (Northern California)".

Thanks!

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

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

发布评论

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

评论(2

南薇 2024-10-07 10:45:17

现在有一种更好的方法,即使用 Amazon.RegionEndpoint 类而不是使用 url 字符串。 Visual Studio 智能感知将为您提供所有区域。

AmazonSQS sqs = AWSClientFactory.CreateAmazonSQSClient(RegionEndpoint.USWest2);

此外,您不需要在参数中传递 appConfig["AWSAccessKey"],只要您在 app.config 中定义了它即可。它会找到它。

There's a better way to do it now that uses the Amazon.RegionEndpoint class rather than using a url string. The Visual Studio intellisense will give you all the regions.

AmazonSQS sqs = AWSClientFactory.CreateAmazonSQSClient(RegionEndpoint.USWest2);

Also, you don't need to pass the appConfig["AWSAccessKey"] in the parameters as long as you have it defined in the app.config. It'll find it.

木緿 2024-10-07 10:45:17

经过深入研究,我找到了解决方案:

AmazonSQS sqs = AWSClientFactory.CreateAmazonSQSClient(
            appConfig["AWSAccessKey"],
            appConfig["AWSSecretKey"],
            new AmazonSQSConfig().WithServiceURL("The url for wanted region")
            );

区域和网址为:

来源:http://aws.amazon.com/sqs/faqs/#What_is_the_EU_End-Point

After a deep research I found the solution:

AmazonSQS sqs = AWSClientFactory.CreateAmazonSQSClient(
            appConfig["AWSAccessKey"],
            appConfig["AWSSecretKey"],
            new AmazonSQSConfig().WithServiceURL("The url for wanted region")
            );

The regions and urls are:

Source: http://aws.amazon.com/sqs/faqs/#What_is_the_EU_End-Point

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