Application Load Balancers must have access logging enabled so you retain detailed request records for incident investigation and traffic analysis. Without logs, security incidents are harder to investigate and you may not meet auditing or compliance requirements.
For CloudFormation, check AWS::ElasticLoadBalancingV2::LoadBalancer resources have a LoadBalancerAttributes entry with Key equal to access_logs.s3.enabled and Value set to true (or the string "true" in templates). Resources missing the LoadBalancerAttributes property, or that include access_logs.s3.enabled with Value set to false (or "false"), will be flagged as non-compliant.
AWSTemplateFormatVersion:"2010-09-09"Description:A simple EC2 instanceParameters:EnvironmentName:Description:An environment name that will be prefixed to resource namesType:StringVPC:Type:AWS::EC2::VPC::IdDescription:Choose which VPC the Application Load Balancer should be deployed toSubnets:Description:Choose which subnets the Application Load Balancer should be deployed toType:List<AWS::EC2::Subnet::Id>SecurityGroup:Description:Select the Security Group to apply to the Application Load BalancerType:AWS::EC2::SecurityGroup::IdResources:LoadBalancer:Type:AWS::ElasticLoadBalancingV2::LoadBalancerProperties:Name:!Ref EnvironmentNameSubnets:!Ref SubnetsSecurityGroups:- !Ref SecurityGroupTags:- Key:NameValue:!Ref EnvironmentNameLoadBalancerAttributes:- Key:access_logs.s3.enabledValue:true
Non-Compliant Code Examples
AWSTemplateFormatVersion:"2010-09-09"Description:A simple EC2 instanceParameters:EnvironmentName:Description:An environment name that will be prefixed to resource namesType:StringVPC:Type:AWS::EC2::VPC::IdDescription:Choose which VPC the Application Load Balancer should be deployed toSubnets:Description:Choose which subnets the Application Load Balancer should be deployed toType:List<AWS::EC2::Subnet::Id>SecurityGroup:Description:Select the Security Group to apply to the Application Load BalancerType:AWS::EC2::SecurityGroup::IdResources:LoadBalancer:Type:AWS::ElasticLoadBalancingV2::LoadBalancerProperties:Name:!Ref EnvironmentNameSubnets:!Ref SubnetsSecurityGroups:- !Ref SecurityGroupTags:- Key:NameValue:!Ref EnvironmentName
AWSTemplateFormatVersion:"2010-09-09"Description:A simple EC2 instanceParameters:EnvironmentName:Description:An environment name that will be prefixed to resource namesType:StringVPC:Type:AWS::EC2::VPC::IdDescription:Choose which VPC the Application Load Balancer should be deployed toSubnets:Description:Choose which subnets the Application Load Balancer should be deployed toType:List<AWS::EC2::Subnet::Id>SecurityGroup:Description:Select the Security Group to apply to the Application Load BalancerType:AWS::EC2::SecurityGroup::IdResources:LoadBalancertest:Type:AWS::ElasticLoadBalancingV2::LoadBalancerProperties:Name:!Ref EnvironmentNameSubnets:!Ref SubnetsSecurityGroups:- !Ref SecurityGroupTags:- Key:NameValue:!Ref EnvironmentNameLoadBalancerAttributes:- Key:access_logs.s3.enabledValue:false
1
2
rulesets:- CloudFormation / AWS # Rules to enforce / AWS.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.