[英]Is it possible to delete the aws Security Group Default Egress allow all Rule with Cloudformation?
我知道 terraform 確實刪除了 AWS 的默認行為。但是使用 cloudformation 可以做到這一點嗎?
CloudFormation 文檔對此有專門的部分:
當您指定 VPC 安全組時,Amazon EC2 會創建一個默認出口規則,該規則允許所有端口上的出口流量和 IP 協議到任何位置。 僅當您指定一個或多個出口規則時,才會刪除默認規則。 如果要刪除默認規則並將出口流量限制在 localhost (127.0.0.1/32) ,請使用以下示例。
sgwithoutegress:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Limits security group egress traffic
SecurityGroupEgress:
- CidrIp: 127.0.0.1/32
IpProtocol: "-1"
VpcId:
Ref: myVPC
並不是說這不會從安全組中物理刪除出口規則。 這將導致創建以下出口規則:
而不是默認的:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.