gpt4 book ai didi

amazon-web-services - Cloudformation ipv4 和 ipv6 导出

转载 作者:行者123 更新时间:2023-12-03 07:41:00 24 4
gpt4 key购买 nike

我想向我的安全组添加 alltraffic ipv4 和 alltraffic ipv6 出站规则。然而,当我定义两者时,Cloudformation 继续只构建 ipv6。

我从以下代码开始:

    SecurityGroupEgressAllTrafficipv4:
Type: 'AWS::EC2::SecurityGroupEgress'
Properties:
Description: "Allow all outbound traffic by default"
GroupId: !Ref "SecurityGroup"
CidrIp: "0.0.0.0/0"
IpProtocol: "-1"

SecurityGroupEgressAllTrafficipv6:
Type: 'AWS::EC2::SecurityGroupEgress'
Properties:
Description: "Allow all outbound traffic by default"
GroupId: !Ref "SecurityGroup"
CidrIpv6: "::/0"
IpProtocol: "-1"

由于只是构建ipv6,所以我找到了这篇文章作为引用:How to specify both IPv6 and v4 in Security Groups in CloudFormation? 。我尝试了评论者发布的格式,但收到错误:错误:模板格式错误:任何 Properties 成员必须是对象。

    SecurityGroupEgressAllTraffic:
Type: 'AWS::EC2::SecurityGroupEgress'
Properties:
- Description: "Allow all outbound traffic by default"
GroupId: !Ref "SecurityGroup"
CidrIp: "0.0.0.0/0"
IpProtocol: "-1"
- Description: "Allow all outbound traffic by default"
GroupId: !Ref "SecurityGroup"
CidrIpv6: "::/0"
IpProtocol: "-1"

有人尝试过成功吗?谢谢。

最佳答案

而不是:

 GroupId: !Ref "SecurityGroup"

应该是:

 GroupId: !GetAtt SecurityGroup.GroupId

关于amazon-web-services - Cloudformation ipv4 和 ipv6 导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68402392/

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