最佳答案
我正在尝试使用 AWS 文档建议的一个简单示例来使用策略 json 文件创建角色 Http://docs.aws.amazon.com/iam/latest/userguide/id_roles_create_for-service.html 我知道错了
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