【问题标题】:AWS JSON syntax error wherever a comma follows curly bracket逗号后跟大括号的 AWS JSON 语法错误
【发布时间】:2021-12-16 16:40:36
【问题描述】:

我正在关注this AWS 教程。在您向 IAM 角色添加权限的第 46 页上,json 代码会导致错误。错误是,Ln 10, Col 1JSON Syntax Error: Fix the JSON syntax error at index 168 line 10 column 1, 逗号跟在大括号后面。删除逗号和/或大括号不起作用。

这是我拥有的 json:

 {
 "Sid": "describeLogGroups",
 "Effect": "Allow",
 "Action": [
 "logs:DescribeLogGroups"
 ],
 "Resource": [
 "arn:aws:logs:<us-west-2>:<MY_ACCOUNT_ID>:log-group:*"
 ]
},
{
 "Sid": "describeLogStreams",
 "Effect": "Allow",
 "Action": [
 "logs:DescribeLogStreams"
 ],
 "Resource": [
 "arn:aws:logs:<us-west-2>:<MY_ACCOUNT_ID>:log-group:*:log-stream:*"
 ]
},
{
 "Sid": "createLogStream",
 "Effect": "Allow",
 "Action": [
 "logs:CreateLogStream",
 "logs:PutRetentionPolicy"
 ],
 "Resource": [
 "arn:aws:logs:<us-west-2>:<MY_ACCOUNT_ID>:loggroup:<SessionManagerLogGroup>:*"
 ]
},
{
 "Sid": "putEvents",
 "Effect": "Allow",
 "Action": [
 "logs:PutLogEvents",
 "logs:GetLogEvents"
 ],
 "Resource": [
     "arn:aws:logs:<us-west-2>:<MY_ACCOUNT_ID>:loggroup:<SessionManagerLogGroup>:log-stream:*"
 ]
},
{
 "Sid": "listBucket",
 "Effect": "Allow",
 "Action": "s3:ListBucket",
 "Resource": "arn:aws:s3:::<session-manager-log-bucket123>"
},
{
 "Sid": "putObject",
 "Effect": "Allow",
 "Action": "s3:PutObject",
 "Resource": "arn:aws:s3:::<session-manager-log-bucket123>/*"
}
 

修复代码需要做哪些调整?

【问题讨论】:

    标签: json amazon-web-services amazon-iam amazon-policy


    【解决方案1】:

    您似乎遗漏了您的政策中的 VersionStatement 部分:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-29
      • 1970-01-01
      • 1970-01-01
      • 2018-04-14
      • 2021-08-22
      • 2017-06-01
      • 1970-01-01
      相关资源
      最近更新 更多