我尝试通过AWS文件提出了一个简单的例子,使用策略JSON文件 http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html 创建一个角色,我得到的错误AWS创建角色 - 已禁止外地
A client error (MalformedPolicyDocument) occurred when calling the CreateRole operation: Has prohibited field Resource
这里的命令,
>> aws iam create-role --role-name test-service-role --assume-role-policy-document file:///home/ec2-user/policy.json
A client error (MalformedPolicyDocument) occurred when calling the CreateRole operation: Has prohibited field Resource
政策是完全相同的,如本例中提到的一个
>> cat policy.json
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::example_bucket"
}
}
我的版本似乎是最新
>> aws --version
aws-cli/1.9.9 Python/2.7.10 Linux/4.1.10-17.31.amzn1.x86_64 botocore/1.3.9
疑难杂症的内容,谢谢。而使用以下 – blueskin
获得同样的错误 - { “版本”: “2012年10月17日”, “声明”:[{ “效果”: “允许”, “校长”:{ “服务“:” s3.amazonaws.com” }, “行动”: “STS:AssumeRole” } ] } 而且上述政策在AWS文档中给出。那么为什么我得到错误? –
@NeerajRathod指定错误。永远不要说“有些错误”。 –