【问题标题】:Create CloudFront distribution that accepts only signed URL’s with serverless创建 CloudFront 分配,仅接受无服务器签名 URL
【发布时间】:2019-10-03 20:03:39
【问题描述】:

我想创建一个只能使用签名 URL 访问的 Web CloudFront 分配。

在手动创建分发时,默认缓存行为设置下有一个限制查看者访问的选项。

我想使用无服务器框架创建分发,但我找不到 Restrict Viewer Access 属性的 CloudFormation 属性。

【问题讨论】:

    标签: amazon-cloudformation amazon-cloudfront serverless


    【解决方案1】:

    这个文档完全不清楚。如果签名密钥在您部署 CloudFront 分配的同一账户中,您只需要:

        TrustedSigners:
          - self
    

    注意,在 2020 年末的某个时候,CloudFront 提供了一种创建签名密钥的方法,该方法不涉及使用 AWS 账户根用户。有关更多信息,请参阅这些文档。 https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html#choosing-key-groups-or-AWS-accounts

    【讨论】:

      【解决方案2】:

      这件事有点晚了。添加到上述答案。

      通过 CloudFromation 有两种方法。

      1. TrustedKeyGroups - CloudFront 可用于验证签名 URL 或签名 cookie 的密钥组列表。

      2. TrustedSigners - AWS 账户 ID 的列表,其公钥 CloudFront 可用于验证签名 URL 或签名 cookie。

      当缓存行为包含 TrustedSigners 或 TrustedKeyGroups 属性时,CloudFront 需要签名 URL 或签名 cookie 用于匹配缓存行为的所有请求。 CloudFront 已通过这些设置假定了这一点,因此您无需需要指定任何其他属性(限制 UI 上的查看器访问)。

      根据 AWS,他们建议使用 TrustedKeyGroups 而不是 TrustedSigners。

      AWS 网址:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-trustedsigners

      【讨论】:

        猜你喜欢
        • 2011-02-04
        • 1970-01-01
        • 2011-02-07
        • 2019-12-23
        • 1970-01-01
        • 2015-06-05
        • 2012-07-14
        • 1970-01-01
        • 2021-02-03
        相关资源
        最近更新 更多