我有这个云形态模板:
"InstanceProfileProd": {
"Type" : "AWS::IAM::InstanceProfile",
"Properties": {
"Path": "/",
"Roles" : [ { "Ref" : "InstanceRole"} ]
}
},
"CompLayer": {
"Type": "AWS::OpsWorks::Layer",
"DependsOn" : "OpsWorksServiceRole",
"Properties": {
"AutoAssignElasticIps" : false,
"AutoAssignPublicIps" : true,
"CustomJson" : {
},
"awscli" : {
"profils" : {
"default" : {
"role_arn": { "Fn::GetAtt": [ "InstanceProfileProd","Arn" ] }
}
}
},
},
"CustomSecurityGroupIds" : { "Ref" : "SecurityGroupIds" },
"EnableAutoHealing" : true,
"InstallUpdatesOnBoot": false,
"LifecycleEventConfiguration": {
"ShutdownEventConfiguration": {
"DelayUntilElbConnectionsDrained": false,
"ExecutionTimeout": 120 }
},
"Name": "Layer",
"Shortname" : "layer1",
"StackId": { "Ref": "CompStack" },
}
},
当我验证模板时,我收到此错误:
An error occurred (ValidationError) when calling the ValidateTemplate operation: Template error: instance of Fn::GetAtt references undefined resource InstanceProfileProd
资源都已正确定义并写得很好;我不明白为什么我会收到这个错误。 实例配置文件在我的opsworks堆栈的所有层中引用。
答案 0 :(得分:1)
您的JSON格式不正确。
CustomJSON
下面的行有一个额外的右括号,应删除:
},
profils
中有一个拼写似乎并非故意(虽然可能与当前错误无关)。