CloudFormation模板报错:VpcId应为String却得到JSONArray,求解决
CloudFormation TargetGroup VpcId 配置错误修复
问题出在VpcId的配置语法上,你用了列表符号-,导致传入的是JSON数组,但AWS::ElasticLoadBalancingV2::TargetGroup的VpcId参数要求是字符串类型的VPC ID,这就是报错的核心原因。
修正后的代码片段:
DevTG: Type: "AWS::ElasticLoadBalancingV2::TargetGroup" Condition: CreateDevResources Properties: HealthCheckIntervalSeconds: 30 HealthCheckPath: "/api/healthcheck" Port: 80 Protocol: "HTTP" HealthCheckPort: "traffic-port" HealthCheckProtocol: "HTTP" HealthCheckTimeoutSeconds: 5 UnhealthyThresholdCount: 2 TargetType: "ip" Matcher: HttpCode: "200,302" HealthyThresholdCount: 5 VpcId: !ImportValue "Deploy1-VPC"
你的Deploy1导出配置是正确的,!Ref EC2VPC返回的是字符串类型的VPC ID,只需要在导入时去掉多余的列表语法,直接使用!ImportValue即可。
内容的提问来源于stack exchange,提问作者user68288
相关产品推荐
相关产品推荐

