简体   繁体   中英

setting up cloudfront with php sdk

I am trying to configure the the amazon cloud front, I have successfully created clouldflayer url and access private s3 bucket from it via console. Now I am trying to do it by php-sdk for that I have tried following code

use Aws\CloudFront\CloudFrontClient;
$cle = new CloudFrontClient([
    'version' => 'latest',
    'region' => 'us-west-2',
    'credentials.ini' => [
        'key' => 'credentials\pk-myKey.pem',
        'secret' => 'secret',
    ],

]);


$result = $cle->getCloudFrontOriginAccessIdentity([
    'Id' => '****', // REQUIRED
]);
print_r($result);

but I am getting error

Fatal error: Uncaught exception 'Aws\\CloudFront\\Exception\\CloudFrontException' with message 'Error executing "GetCloudFrontOriginAccessIdentity" on " https://cloudfront.amazonaws.com/2015-04-17/origin-access-identity/cloudfront/SDF345G ";

AWS HTTP error: Client error: 403 SignatureDoesNotMatch (client): Credential should be scoped to a valid region, not 'us-west-2'. -

and I have tried all reason one by one but its not working

Credential should be scoped to a valid region, not 'us-west-2'.

与大多数AWS不同,CloudFront并非区域性服务,而是全局性的,通过us-east-1进行配置和管理,而与任何相关服务(S3,EC2等)的部署区域无关。

'region' => 'us-east-1',

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM