如果我要使用 AWS 文档来使用 CloudFormation ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html ) 创建安全组,那么它似乎缺乏我想要实现的目标。有很多示例可以将导出规则配置为使用 CIDR 值作为目的地,这一切都非常好。
但我想要实现的是使用前缀列表 id (pl-112233) 作为网络目的地
例如:
"SecurityGroupEgress" : [{
"IpProtocol" : "tcp",
"FromPort" : 80,
"ToPort" : 80,
"CidrIp" : "0.0.0.0/0" # using prefix list example pl-112233
}]
不幸的是,我找不到对此要求的任何支持,我想了解其他人是否遇到过这个困难。我应该指出,这些前缀列表是预先存在的,不需要作为此 CloudFormation 的一部分进行创建。
最佳答案
基于AWS::EC2::SecurityGroup Egress - AWS CloudFormation ,看来你可以使用:
"SecurityGroupEgress" : [{
"IpProtocol" : "tcp",
"FromPort" : 80,
"ToPort" : 80,
"DestinationPrefixListId" : "pl-112233"
}]
关于json - 在安全组中使用前缀列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71790547/