Cargo
Cargo

Reputation: 185

Set the region on creating the Amazon SQS in C#

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

Thanks!

Upvotes: 5

Views: 2302

Answers (2)

wisbucky
wisbucky

Reputation: 37993

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.

Upvotes: 5

Cargo
Cargo

Reputation: 185

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

Upvotes: 3

Related Questions