2017-09-19 49 views
0

只有IAM政策,我得到的組,角色,用戶需要的錯誤:無法創建與我有創造cloudformation.But IAM政策問題cloudformation

這裏是我的代碼:

{ 
"AWSTemplateFormatVersion": "2010-09-09", 
"Description": "AWS CloudFormation Template IAM Groups and Policies", 
"Resources": { 
    "PolicyAutoScalingLimitedOperation": { 
     "Type": "AWS::IAM::Policy", 
     "Properties": { 
      "PolicyName": "AutoScaling-Limited-Operation", 
      "PolicyDocument": { 
       "Statement": [{ 
         "Effect": "Allow", 
         "Action": [ 
          "dynamodb:*" 
         ], 
         "Resource": "*" 
        }, 
        { 
         "Effect": "Allow", 
         "Action": [ 
          "cloudwatch:PutMetricData" 
         ], 
         "Resource": "*" 
        }, 
        { 
         "Effect": "Allow", 
         "Action": [ 
          "xray:PutTraceSegments", 
          "xray:PutTelemetryRecords" 
         ], 
         "Resource": "*" 
        }, 
        { 
         "Effect": "Allow", 
         "Action": [ 
          "s3:Get*", 
          "s3:List*", 
          "s3:PutObject" 
         ], 
         "Resource": "*" 
        }, 
        { 
         "Effect": "Allow", 
         "Action": [ 
          "logs:PutLogEvents", 
          "logs:CreateLogStream" 
         ], 
         "Resource": "arn:aws:logs:*:*:log-group:/aws/elasticbeanstalk*" 
        }, 
        { 
         "Effect": "Allow", 
         "Action": [ 
          "kms:ListAliases", 
          "kms:ListKeys", 
          "kms:Encrypt", 
          "kms:Decrypt" 
         ], 
         "Resource": "*" 
        } 
       ] 
      } 
     } 
    } 
} 

}

現在,當我運行它,我得到:

At least one of [Groups,Roles,Users] must be non-empty. 

是否牛逼意思是我不能在不添加用戶/角色的情況下使用cloudformation創建策略?

+1

的文檔指出AWS :: IAM ::政策資源並不簡單地創建一個策略。它將策略與現有的IAM組,角色或用戶相關聯(如下所示:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html)。 – jarmod

回答