【问题标题】:Invalid according to Policy: Policy Condition failed: ["eq", "$x-amz-storage-class", "STANDARD_IA"]根据策略无效:策略条件失败:["eq"、"$x-amz-storage-class"、"STANDARD_IA"]
【发布时间】:2020-11-23 17:02:04
【问题描述】:

我正在尝试在从网页帖子上传时指定 AWS S3 对象(图像文件)的存储类。没有存储类规范,一切正常,但是当我将它添加到策略时,页面重定向到带有 XML 指示的错误页面:

Invalid according to Policy: Policy Condition failed: ["eq", "$x-amz-storage-class", "STANDARD_IA"]

我尝试了存储类的不同值,例如大写/小写、STANDARD、STANDARD-IA 等,但似乎没有任何效果。任何帮助将不胜感激。

这是编码前的对象策略:

{
    "expiration": "2040-01-01T00:00:00Z",
    "conditions": [ 
        {"bucket": "dev-image"},
        ["starts-with", "$key", ""],
        {"acl": "private"},
        {"success_action_redirect": "http://localhost/Image.jsp"},
        ["starts-with", "$Content-Type", ""],
        {"x-amz-storage-class": "STANDARD_IA"},              <<<<< Causes Problem
        ["content-length-range", 0, 10485760]
    ]
}

【问题讨论】:

  • 该字段必须同时添加到表单和策略中。见my answer here

标签: amazon-s3 policy storage-class-specifier


【解决方案1】:

错误消息表明表单字段与策略条件不匹配。策略条件必须与表单字段 1:1 匹配;它们的名称和值必须匹配。向表单添加值为“STANDARD_IA”的输入字段“x-amz-storage-class”可修复错误。

【讨论】:

    猜你喜欢
    • 2014-05-23
    • 1970-01-01
    • 2013-12-29
    • 1970-01-01
    • 2019-09-03
    • 1970-01-01
    • 2013-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多