Developer Guide

AWS Region Selection

AWS Regions allow you to access AWS services that physically reside in a specific geographic region. This can be useful for redundancy and to keep your data and applications running close to where you and your users will access them. You can specify a region when creating the AWS service client by using the RegionEndpoint class.

Here is an example that instantiates an Amazon EC2 client in a specific region.

AmazonEC2Client ec2Client = new AmazonEC2Client(RegionEndpoint.USEast1);

Regions are isolated from each other. For example, you can't access US East (N. Virginia) resources when using the EU (Ireland) region. If your code needs access to multiple AWS Regions, we recommend you create a separate client for each region.

To use services in the China (Beijing) Region, you must have an account and credentials that are specific to the China (Beijing) Region. Accounts and credentials for other AWS Regions won't work for the China (Beijing) Region. Likewise, accounts and credentials for the China (Beijing) Region won't work for other AWS Regions. For information about endpoints and protocols that are available in the China (Beijing) Region, see China (Beijing) Region.

New AWS services can be launched initially in a few regions and then supported in other regions. In these cases you don't need to install the latest SDK to access the new regions. You can specify newly added regions on a per-client basis or globally.


Construct the new region endpoint by using GetBySystemName:

var newRegion = RegionEndpoint.GetBySystemName("us-west-new"); using (var ec2Client = new AmazonEC2Client(newRegion)) { // Make a request to EC2 using ec2Client }

You can also use the ServiceURL property of the service client configuration class to specify the region. This technique works even if the region endpoint does not follow the regular region endpoint pattern.

var ec2ClientConfig = new AmazonEC2Config { // Specify the endpoint explicitly ServiceURL = "" }; using (var ec2Client = new AmazonEC2Client(newRegion)) { // Make a request to EC2 using ec2Client }


You can set the region globally in three ways.

You can set the AWSConfigs.AWSRegion property,

AWSConfigs.AWSRegion = "us-west-new"; using (var ec2Client = new AmazonEC2Client()) { // Make request to Amazon EC2 using ec2Client }

You can set the AWSRegion key in the appSettings section of the app.config file.

<configuration> <appSettings> <add key="AWSRegion" value="us-west-2"/> </appSettings> </configuration>

You can set the region attribute in the aws section as described in AWSRegion.

<aws region="us-west-2"/>

To view the current list of all supported regions and endpoints for each AWS service, see Regions and Endpoints in the Amazon Web Services General Reference.

On this page: