For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cloudformation-aws-cloudfront-logging-disabled.md.
A documentation index is available at /llms.txt.
CloudFront distributions must have access logging enabled so viewer requests are captured for incident investigation and traffic analysis. Without logs, you cannot audit access patterns, investigate abuse, or troubleshoot delivery problems.
For AWS::CloudFront::Distribution resources, DistributionConfig.Logging must be defined when the distribution is enabled (that is, DistributionConfig.Enabled is not set to false).
The logging configuration must include a Bucket value that points to an Amazon S3 bucket using the S3 domain suffix (it must end with .s3.amazonaws.com). Resources missing Logging or with a Bucket that does not end with .s3.amazonaws.com will be flagged.
Secure configuration example:
MyDistribution:Type:AWS::CloudFront::DistributionProperties:DistributionConfig:Enabled:trueLogging:Bucket:my-log-bucket.s3.amazonaws.comIncludeCookies:falsePrefix:access-logs/# ... other distribution settings ...