属性Target的值必须是对象列表“ AWS :: ElasticLoadBalancingV2 :: TargetGroup”错误

时间:2019-10-20 04:29:46

标签: amazon-cloudformation

以下是我在云形成网络负载均衡器模板中使用的代码,请您帮忙

"TargetGroup": {
            "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
            "Properties": {
                "Name": "MyTargets",
                "Port": 10,
                "TargetType": "instance",
                "Protocol": "TCP",
                "TargetGroupAttributes": [{
                    "Key": "deregistration_delay.timeout_seconds",
                    "Value": "20"
                }],
                "VpcId": {
                    "Fn::Select": [
                        "0",
                        {
                            "Ref": "VPC"
                        }
                    ]
                },
                "Targets": [ "Id", {"Ref": "Id.ins1"    },  "Id", {"Ref": "Id.ins2"}    ]
            }
        },

1 个答案:

答案 0 :(得分:0)

您需要检查Targets的值。目标应该是TargetDescription的列表。 TargetDescription的语法:

{
  "AvailabilityZone" : String,
  "Id" : String,
  "Port" : Integer
}

在您的情况下,将是这样的:

"Targets":[ { "Id":{ "Ref":"Id.ins1" },"Port":80 },{ "Id":{ "Ref":"Id.ins2" },"Port":80 } ]