AWS infrastructure services are hosted in multiple locations world-wide. These regions are logically isolated from each other, so for example, you won't be able to access US East resources when communicating with the EU West endpoint. You might choose a region to optimize latency, minimize costs, or address regulatory requirements.
For more information on how services operate in each region, see the service Developer Guide at http://aws.amazon.com/documentation. For information about AWS regions and endpoints, go to Regions and Endpoints in the Amazon Web Services General Reference.
The AWS SDKs support making requests to each region. The region endpoint is set by configuring the client object. The following examples demonstrate how to configure the endpoint used in your requests to a service.
Example Using the AWS SDK for Java or AWS SDK for Android
AmazonEC2Client ec2 = new AmazonEC2Client(myCredentials); ec2.setEndpoint("ec2.ap-southeast-1.amazonaws.com"); ec2.describeInstances();
Note: See AWS SDK for Java Tips and Tricks for more information about configuring the client object for the AWS SDK for Java.
Example Using the AWS SDK for .NET
AmazonElasticLoadBalancingConfig config = new AmazonElasticLoadBalancingConfig(); config.ServiceURL = "https://ap-southeast-1.elasticloadbalancing.amazonaws.com"; AmazonElasticLoadBalancing elb = new AmazonElasticLoadBalancingClient("ACCESS_KEY", "SECRET_KEY", config);
Example Using the AWS SDK for PHP
$ec2 = new AmazonEC2(); $ec2->set_hostname('ec2.ap-southeast-1.amazonaws.com'); $response = $ec2->describe_instances();
Example Using the AWS SDK for iOS
AmazonSimpleDBClient *sdb = [[AmazonSimpleDBClient alloc] initWithAccessKey:@"ACCESS_KEY" withSecretKey:@"SECRET_KEY"]; sdb.endpoint = @"https://sdb.amazonaws.com";
For information about AWS regions and endpoints, go to Regions and Endpoints in the Amazon Web Services General Reference.