How to set the EndPoint / Region for the C# .NET SDK : EC2Client?

Stef Heyenrath picture Stef Heyenrath · Jan 21, 2012 · Viewed 21.1k times · Source

In the JAVA SDK it's possible to set the endpoint, see here.

But how to do this for .NET SDK ? And what are the names to use?

Because it seems that a default endpoint "US East (Northern Virginia) Region" is always used.

Answer

Marek picture Marek · Apr 15, 2014

You can also use an endpoint definitions delivered with Amazon SDK:

var ec2Client = new AmazonEC2Client(RegionEndpoint.EUWest1);

Since I believe hard-coding such values as endpoint addresses is not a best practice I use more configurable version (i.e. endpoint configured from web.config/app.config):

var region = RegionEndpoint.GetBySystemName("eu-west-1");
var ec2Client = new AmazonEC2Client(region);