【问题标题】:Getting a syntax error in creating a new policy using aws cli使用 aws cli 创建新策略时出现语法错误
【发布时间】:2020-10-02 18:22:11
【问题描述】:

我试图运行以下命令来创建新策略。

$ aws iam create-policy --policy-name my-policy --policy-document file://ex-policy.json

但是我得到了以下错误。

调用 CreatePolicy 操作时发生错误 (MalformedPolicyDocument):策略中的语法错误。

policy.json 在我的当前目录中,看起来像这样。

{
  "Version": "2012-10-17T00:00:00.000Z",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["sns:Publish"],
      "Resource": ["*"]
    }
  ]
}

我的问题是什么?

【问题讨论】:

    标签: amazon-web-services aws-cli


    【解决方案1】:

    在此政策中,"Version": "2012-10-17T00:00:00.000Z", 不正确。应该是:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": ["sns:Publish"],
          "Resource": ["*"]
        }
      ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-02
      • 2023-02-02
      • 2023-01-30
      • 2017-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多