如何代表某个原始访问标识(云前端)签署URL

时间:2016-07-02 13:00:21

标签: php amazon-web-services amazon-s3 amazon-cloudfront

我想要云前端(和s3)的两个原始访问标识。一个可以只查看内容,另一个可以放置内容(可能只是删除内容)

我知道我可以创建一个Origin访问标识,在我的s3存储桶策略中,我可以指定哪个标识有多少访问权限。

但是,在签署网址时,我没有看到任何选择此身份的选项。我正在使用的PHP代码:

        $customPolicy = <<<POLICY
{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Sid":"statement1",
         "Effect":"Allow",
         "Action":[
            "s3:CreateBucket", "s3:ListAllMyBuckets", "s3:GetBucketLocation"  
         ],
         "Resource":[
            "arn:aws:s3:::*"
         ]
       }
    ]
}

POLICY;



// Create a signed URL for the resource using the canned policy
        $signedUrlCannedPolicy = $cloudFront->getSignedUrl([
            'url'         => $streamHostUrl . '/' . $resourceKey,
            'private_key' => base_path().'/'.'cloudfront.pem',
            'key_pair_id' => 'my key pair id',
            'policy' => $customPolicy

        ]);

如何告诉谁代表谁签名? 我在http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html#private-content-creating-cloudfront-key-pairs之后为云前端创建了一个密钥对。

1 个答案:

答案 0 :(得分:0)

您的密钥对已分配给IAM用户。这是签名身份。