尝试使用 aws cli 创建新角色时出现错误。
这是错误消息。
An error occurred (MalformedPolicyDocument) when calling the CreateRole operation: This policy contains invalid Json
为了创建一个角色,我运行以下命令。
aws iam create-role --path /role-service/ --role-name Test-Role --assume-role-policy-document policy.json
并且 policy.json 是
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "cognito-idp.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "d611c8fd-0fd1-469a-a5ea-b02186042023"
}
}
}
]
}