我有一个 PHP 应用程序,使用 symfony2、silex 和 AWS DynamoDB SDK。它工作正常。DynamoDB 在东海岸创建。
我们有第二个 AWS 账户,我们复制了 DynamoDB 结构(表名、表结构等都相同)。此 DynamoDB 安装位于西海岸(加利福尼亚北部)。
当我们尝试使用第二个 AWS 凭证时,我的应用程序无法运行。
当我尝试这样做时:
$res = $app['db']->describe_table(array('TableName' => 'account'));
我转储 $res,这就是我得到的:
CFResponse Object
(
[header] => Array
(
[x-amzn-requestid] => xxxxxxxxxxxxxxxxxxxxxxxxxx
[x-amz-crc32] => xxxxxxxxxxxxx
[content-type] => application/x-amz-json-1.0
[content-length] => 143
[date] => Wed, 28 Nov 2012 20:49:31 GMT
[_info] => Array
(
[url] => https://dynamodb.us-east-1.amazonaws.com/
[content_type] => application/x-amz-json-1.0
[http_code] => 400
[header_size] => 224
[request_size] => 896
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.363967
[namelookup_time] => 0.008497
[connect_time] => 0.091183
[pretransfer_time] => 0.263514
[size_upload] => 28
[size_download] => 143
[speed_download] => 392
[speed_upload] => 76
[download_content_length] => 143
[upload_content_length] => 0
[starttransfer_time] => 0.363929
[redirect_time] => 0
[certinfo] => Array
(
)
[redirect_url] =>
[method] => POST
)
[x-aws-stringtosign] => AWS4-HMAC-SHA256
20121128T204931Z
20121128/us-east-1/dynamodb/aws4_request
xxxxxxxxxxxxxxxxxxxxxxx
[x-aws-canonicalrequest] => POST
/
content-length:28
content-type:application/x-amz-json-1.0
host:dynamodb.us-east-1.amazonaws.com
x-amz-date:20121128T204931Z
x-amz-target:DynamoDB_20111205.DescribeTable
content-length;content-type;host;x-amz-date;x-amz-target
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[x-aws-request-headers] => Array
(
[Content-Length] => 28
[Content-Type] => application/x-amz-json-1.0
[Host] => dynamodb.us-east-1.amazonaws.com
[X-Amz-Date] => 20121128T204931Z
[X-Amz-Target] => DynamoDB_20111205.DescribeTable
[Authorization] => AWS4-HMAC-SHA256 Credential=AKIAJAIBF2DKGD2UD3YQ/20121128/us-east-1/dynamodb/aws4_request,SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-target,Signature=xxxxxxxxxxxxxxxxxxxxxxxx
[Expect] =>
)
[x-aws-body] => {"TableName":"account"}
)
[body] => CFSimpleXML Object
(
[__type] => com.amazonaws.dynamodb.v20111205#ResourceNotFoundException
[message] => Requested resource not found: Table: account not found
)
[status] => 400
)
我认为唯一需要的配置是在 AWS DynamoDB SDK 文件 config.inc.php 中,我只能在其中配置凭证。情况似乎并非如此,因为响应包含对东海岸的所有这些引用,而我的目标 DynamoDB 表位于西海岸。有什么想法可以告诉它 AmazonSDK 指向另一个区域吗?还有什么我应该关心的问题吗?