cloudfront 签名 url 有问题(没有找到给定参数的帐户)

Have a problem with cloudfront signed urls (No account found for the given parameters)

我正在尝试使用 aws-sdk-php

从云端创建签名 URL

我已经创建了 WEB 和 RTMP 分发

这是我用来做那个的代码

这是start.php

<?php


require 'vendor/autoload.php';

use Aws\S3\S3Client;
use Aws\CloudFront\CloudFrontClient;

$config = require('config.php');


// S3


$client = new Aws\S3\S3Client([
    'version'     => 'latest',
    'region'      => 'us-east-2',

]);

// CloudFront


$cloudfront = CloudFrontClient::factory([

    'version'     => 'latest',
    'region'      => 'us-east-2',

]);

这是config.php

<?php



return [

's3'=>[

    'key'       => 'XXXXXXXXXXXXXXXXXXXXXXXXXX',
    'secret'    => 'XXXXXXXXXXXXXXXXXXXXXXXXXX',
    'bucket'    => 'hdamovies',
    'region'    => 'us-east-2',

],

'cloudFront'    =>  [
    'url'   =>  'https://d2t7o0s69hxjwd.cloudfront.net',
],

];

这是index.php

<?php



require 'config/start.php';


$video = 'XXXXXXXXXXX.mp4';
$expiry = new DateTime( '+1 hour' );

$url = $cloudfront->getSignedUrl([

    'private_key'   => 'pk-XXXXXXXXXXXXXXXXXXXXX.pem', 
    'key_pair_id'   => 'XXXXXXXXXXXXXXXXXXXXX',
    'url'   => "{$config['cloudFront']['url']}/{$video}",
    'expires'   => strtotime('+10 minutes'),

]);


echo "<a href=".$url.">Downlod</a>";

当我点击 link 时出现错误

<Error>
<Code>KMS.UnrecognizedClientException</Code>
<Message>No account found for the given parameters</Message>
<RequestId>0F0A772FE67F0503</RequestId>


<HostId>juuIQZKHb1pbmiVkP7NVaKSODFYmBtj3T9AfDNZuXslhb++LcBsw9GNjpT0FG8MxgeQGqbVo+bo=</HostId></Error>

这里有什么问题,我该如何解决?

CloudFront 不支持下载使用 KMS 密钥在 S3 中存储、加密的对象,显然是因为 CloudFront 源访问身份不是 IAM 用户,因此无法授权它拥有对 KMS 的必要访问权限.

https://forums.aws.amazon.com/thread.jspa?threadID=268390