Your issue is a missing S3 bucket policy that grants CloudFront permission to deliver logs. This is the most common cause of missing CloudFront access logs and requires addressing all three configuration areas.
S3 Bucket Policy for Log Delivery: CloudFront uses a specific AWS service account to write logs. Your bucket needs a policy granting PutObject and PutObjectAcl permissions to this account. Add this policy to your cdn-logs bucket:
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "AllowCloudFrontLogDelivery",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": "arn:aws:s3:::cdn-logs/*",
"Condition": {
"StringEquals": {
"aws:SourceAccount": "YOUR_ACCOUNT_ID"
}
}
}]
}
CloudFront Logging Configuration: Your configuration format needs correction. In the CloudFront console or API, specify only the bucket name without the .s3.amazonaws.com suffix:
Bucket for Logs: cdn-logs
Log Prefix: cloudfront/production/
Cookie Logging: Off (or On if needed)
The console adds the S3 domain automatically. Using cdn-logs.s3.amazonaws.com in configuration can cause routing issues where CloudFront attempts to resolve this as a custom domain.
Cross-Account Permissions (if applicable): If your CloudFront distribution and S3 bucket are in different AWS accounts, you need additional configuration:
- Bucket policy must reference the source account where CloudFront distribution exists
- Bucket ACLs should allow log delivery from CloudFront service
- Bucket ownership controls should allow ACL-based permissions
For same-account setup (your case), the bucket policy above is sufficient.
Additional Considerations:
- Bucket cannot use SSE-KMS encryption (SSE-S3 or no encryption only)
- Bucket must not have “Block all public access” preventing ACL-based permissions from AWS services
- Log delivery typically begins within 1-2 hours after policy is applied, but can take up to 24 hours
- Logs are delivered multiple times per hour in compressed .gz files
Verification Steps:
- Apply the bucket policy with your actual account ID
- Wait 2-4 hours for first log files to appear
- Check CloudFront metrics to confirm distribution is receiving traffic
- Verify bucket region matches CloudFront logging requirements (any region works, but us-east-1 is standard)
After applying this policy, logs should start appearing within a few hours. The combination of proper bucket policy permissions, corrected CloudFront configuration format, and appropriate cross-account settings (when needed) resolves all three focus areas preventing log delivery.