AWS SDK for PHP
Developer Guide (Version v1.0.0)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

AWS Region Selection

AWS Regions allow you to access AWS services that reside physically in a specific geographic region. This is useful both for redundancy and to keep your data and applications running close to where you and your users will access them. To select a particular region, configure the AWS client object with an endpoint that corresponds to that region.

For example, to configure an Amazon EC2 client to connect to the Asia Pacific (Singapore) region, use the following code:

$ec2 = new AmazonEC2();
$ec2->set_hostname('ec2.ap-southeast-1.amazonaws.com');
$response = $ec2->describe_instances();

Be aware that 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. If you're code accesses multiple AWS regions, we recommend that you instantiate a specific client for each region.