gpt4 book ai didi

aws-cloudformation - 解决 CloudFormation 模板错误中的 "Id must be a String"

转载 作者:行者123 更新时间:2023-12-03 07:39:19 25 4
gpt4 key购买 nike

以下内容位于我的 CloudFormation 模板的资源部分:

  myAlbTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckPath: /
HealthCheckIntervalSeconds: 10
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
Matcher:
HttpCode: 200,302
Name: myWebServer
Protocol: HTTP
Port: 80
Targets:
- Id: Fn::ImportValue: myVPC-myWebServer1
Port: 80
- Id: Fn::ImportValue: myVPC-myWebServer2
Port: 80
TargetType: instance
UnhealthyThresholdCount: 5
VpcId:
Fn::ImportValue: myVPC

当我加载模板时,我收到一条错误,指示目标“Id 必须是字符串”。

根据我读到的另一个线程,我已将值用引号引起来,并且还尝试使用 !Sub,但无济于事。

有谁知道如何解决这个问题吗?我已经浏览过文档,但我显然遗漏了一些东西(可能是基本的)。

预先感谢您的指导!

最佳答案

这个问题已经解决了。这是一个对齐/格式问题。我将在这里为任何可能感兴趣的人发布正确的格式。

      Targets:
- Id:
Fn::ImportValue:
!Sub 'myVPC-myWebServer1'
Port: 80
- Id:
Fn::ImportValue:
!Sub 'myVPC-myWebServer2'
Port: 80

关于aws-cloudformation - 解决 CloudFormation 模板错误中的 "Id must be a String",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73754935/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com