【发布时间】:2021-11-23 09:46:49
【问题描述】:
我正在使用以下 cloudformation 模板为 NLB 创建目标组。在执行 cloudformation 模板时,由于 Targets: - Id: !Ref InstanceID 行,我收到错误“属性 Id 的值必须是字符串类型”。我选择了 AWS::EC2::Instance::Id 作为列表,因为想要关联此目标组中的多个实例。请任何人帮助我了解确切的问题在哪里。
Parameters:
InstanceID:
Description: Please Select the Instance IDs
Type: List<AWS::EC2::Instance::Id>
Description: Select Instance ID to associate it with the Target Group
VPC:
Description: The VPC to deploy to the target group
Type: AWS::EC2::VPC::Id
ConstraintDescription: Select VPC ID for the Target Group
Resources:
EC2TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckIntervalSeconds: 30
HealthCheckProtocol: TCP
HealthCheckTimeoutSeconds: 10
HealthyThresholdCount: 3
Name: NLBTargetGroupForEndpointService
Port: 22
Protocol: TCP
TargetType: instance
Targets:
- Id: !Ref InstanceID
UnhealthyThresholdCount: 3
VpcId: !Ref VPC
Tags:
- Key: Name
Value: EC2TargetGroup
- Key: Port
Value: 22
- Key: Protocol
Value: TCP
【问题讨论】:
标签: amazon-web-services amazon-cloudformation amazon-elb