gpt4 book ai didi

amazon-web-services - 在 Cloudformation 上使用私有(private) IP 值的加入、选择和拆分

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

我在尝试在 Cloudformation 中编写反向区域条目 dns 时遇到错误。

这是我的条目:

EC2DNSReverseZone:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId: !Ref ReverseHostedZoneId
Name:
- !Join [ '', [ !Select [3, !Split [ ".", !GetAtt LinuxEC2Instance.PrivateIp ] ], .xxx.xxx.xx.in-addr.arpa ] ]
Type: PTR
TTL: '86400'
ResourceRecords:
- xxxxxxxx

部署 Cloudformation 条目时,我收到以下错误:

Value of property Name must be of type String

我认为这与 LinuxEC2Instance.PrivateIp 是一个数字并且拆分数字无效有关。但这只是一个猜测。我有点不知所措,我在这里做错了什么。 LinuxEC2Instance.PrivateIp 是一个 IP 地址,例如 10.104.209.113,我只需要最后一部分,因此我需要该数字中的 113,这就是我在这里使用 split 的原因。

我需要做什么来修复此错误?

最佳答案

I assume that this has to do with the fact that LinuxEC2Instance.PrivateIp is a number and it is not valid to Split a number.

不,不是。这意味着您的 NameList,因为您将 - 放入其中。它必须是纯 String,因此应该是(无 -):

  Name:
!Join [ '', [ !Select [0, !Split [ ".", !GetAtt LinuxEC2Instance.PrivateIp ] ], .xxx.xxx.xx.in-addr.arpa ] ]

Join 可能还有其他错误,但我只关注您当前的错误消息。

关于amazon-web-services - 在 Cloudformation 上使用私有(private) IP 值的加入、选择和拆分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67684640/

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