AWS Cloudformation:无效模板资源属性错误

AWS Cloudformation:无效模板资源属性错误

我正在尝试创建一个 Cloudformation 模板来配置 IAM 角色。

据我所知,我的 JSON 是 100% 有效的,但显然我忽略了其他东西,因为它无法验证:

调用 ValidateTemplate 操作时发生客户端错误 (ValidationError):模板资源属性“BambooInstanceProfile”无效

我的代码:

{
  "Description" : "Bamboo IAM role",

  "Parameters" : {

  },



  "Resources" : {  


    "BambooAgentRole" : {
         "Type": "AWS::IAM::Role",
         "Properties": {
            "AssumeRolePolicyDocument": {
               "Version" : "2012-10-17",
               "Statement": [ {
                  "Effect": "Allow",
                  "Principal": {
                     "Service": [ "ec2.amazonaws.com" ]
                  },
                  "Action": [ "sts:AssumeRole" ]
               }  ]

            },
            "Path": "/devtools/bamboo/",
            "Policies": [ {
               "PolicyName": "ec2_bamboo",
               "PolicyDocument": {
                  "Version" : "2012-10-17",
                  "Statement": [ {
                    "Effect": "Allow",
                    "Action": [
                      "ec2:DescribeTags",
                      "ec2:DescribeInstances"
                      ],
                      "Resource": "*"
                  } ]
              }
              } ]
      },
      "BambooInstanceProfile": {
        "Type": "AWS::IAM::InstanceProfile",
        "Properties": {
           "Path": "/devtools/bamboo/",
           "Roles": [ {
              "Ref": "BambooAgentRole"
           } ]
        }  
      }
    }  
  },







  "Outputs" : {
    "IAM" : { "Value" : { "Ref" : "BambooInstanceProfile" }}
  }


}

我在这里忽略了什么?

答案1

您已将“BambooInstanceProfile”设置为“BambooAgentRole”的属性,而不是其自身的资源。}您的“BambooInstanceProfile”之前还需要添加一个。

相关内容