AWS

Set the region for AWS SDK for PHP

If you are using the PHP SDK for AWS, by default, all operations are done on their Virginia data center.

If you want to use a different data center, you must define it with the set_hostname command

$sdb = new AmazonSDB();<br>
$sdb -> set_hostname('sdb.ap-northeast-1.amazonaws.com');

There are two parts to this,

  • The Service (eg SDB, EC2, etc..)
  • The Data Center (eg Tokyo)

Valid Data Centers are

Location region Position Code
Tokyo Asia Pacific North East ap-northeast-1.amazonaws.com
Singapore Asia Pacific South East ap-southeast-1.amazonaws.com
Ireland Europe West eu-west-1.amazonaws.com
Virginia North America East us-east-1.amazonaws.com
Northern California North America West us-west-1.amazonaws.com
Oregan North America West us-west-2.amazonaws.com
Sao Paulo South America East sa-east-1.amazonaws.com

Be careful with the URLs as they are not always consistent. S3 is done slightly differently for example.

Leave a Reply