AWS JSON 大括号后面有逗号的语法错误
AWS JSON syntax error wherever a comma follows curly bracket
我正在学习 this AWS 教程。在向 IAM 角色添加权限的第 46 页,json 代码导致错误。错误是 Ln 10, Col 1JSON Syntax Error: Fix the JSON syntax error at index 168 line 10 column 1,
大括号后面有逗号的地方。删除逗号 and/or 大括号不起作用。
这是 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>/*"
}
修复代码需要做哪些调整?
您似乎遗漏了保单的 Version
和 Statement
部分:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "...",
"Resource": "..."
}
]
}
我正在学习 this AWS 教程。在向 IAM 角色添加权限的第 46 页,json 代码导致错误。错误是 Ln 10, Col 1JSON Syntax Error: Fix the JSON syntax error at index 168 line 10 column 1,
大括号后面有逗号的地方。删除逗号 and/or 大括号不起作用。
这是 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>/*"
}
修复代码需要做哪些调整?
您似乎遗漏了保单的 Version
和 Statement
部分:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "...",
"Resource": "..."
}
]
}