Load balancers must not reference security groups that lack inbound (ingress) rules, because a security group without ingress can block legitimate client traffic to the load balancer and indicates an incomplete network configuration that may cause availability issues.
For each load balancer resource (for example, AWS::ElasticLoadBalancing::LoadBalancer or AWS::ElasticLoadBalancingV2::LoadBalancer), each entry in the Properties.SecurityGroups property must reference an AWS::EC2::SecurityGroup with ingress rules defined. The security group must either define a non-empty SecurityGroupIngress property or be targeted by one or more AWS::EC2::SecurityGroupIngress resources whose GroupId references it. Resources missing the SecurityGroupIngress key, with SecurityGroupIngress set to an empty list, or with no AWS::EC2::SecurityGroupIngress resources referencing the group will be flagged.
Secure example with an inline SecurityGroup ingress definition:
MySecurityGroup:Type:AWS::EC2::SecurityGroupProperties:GroupDescription:Allow HTTP to load balancerVpcId:vpc-123456SecurityGroupIngress:- IpProtocol:tcpFromPort:80ToPort:80CidrIp:0.0.0.0/0
Compliant Code Examples
AWSTemplateFormatVersion:2010-09-09Resources:sgwithingress:Type:AWS::EC2::SecurityGroupProperties:GroupDescription:Limits security group egress trafficSecurityGroupIngress:- IpProtocol:tcpFromPort:80ToPort:80CidrIp:0.0.0.0/0MyLoadBalancer:Type:AWS::ElasticLoadBalancing::LoadBalancerProperties:SecurityGroups:- sgwithingress
Non-Compliant Code Examples
AWSTemplateFormatVersion:2010-09-09Resources:sgwithoutingress:Type:AWS::EC2::SecurityGroupProperties:GroupDescription:Limits security group egress trafficMyLoadBalancer:Type:AWS::ElasticLoadBalancing::LoadBalancerProperties:SecurityGroups:- sgwithoutingress
1
2
rulesets:- CloudFormation / AWS # Rules to enforce / AWS.
맞춤형 데모 요청
Datadog 시작하기
Ask AI
AI-generated responses may be inaccurate. Verify important info.