For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/ansible-aws-cdn-configuration-is-missing.md.
A documentation index is available at /llms.txt.
CloudFront distributions must be enabled and include at least one origin so traffic is routed through the CDN. This ensures requests benefit from CloudFront protections such as caching, TLS termination, WAF rules, and DDoS mitigation. A disabled or origin-less distribution can cause traffic to bypass the CDN and expose origin servers.
This rule inspects Ansible tasks using the community.aws.cloudfront_distribution or cloudfront_distribution modules. It requires the enabled property to be present and set to true, and the origins property to be defined with at least one origin entry. Tasks missing enabled or origins, or with enabled: false, are flagged as misconfigured.
- name:create a distribution with an origin, logging and default cache behaviorcommunity.aws.cloudfront_distribution:state:presentcaller_reference:unique test distribution IDorigins:- id:'my test origin-000111'domain_name:www.example.comorigin_path:/productioncustom_headers:- header_name:MyCustomHeaderNameheader_value:MyCustomHeaderValuedefault_cache_behavior:target_origin_id:'my test origin-000111'forwarded_values:query_string:truecookies:forward:allheaders:- '*'viewer_protocol_policy:allow-allsmooth_streaming:truecompress:trueallowed_methods:items:- GET- HEADcached_methods:- GET- HEADlogging:enabled:trueinclude_cookies:falsebucket:mylogbucket.s3.amazonaws.comprefix:myprefix/enabled:truecomment:this is a CloudFront distribution with logging
Non-Compliant Code Examples
- name:create a distribution without an origin and with enabled=falsecommunity.aws.cloudfront_distribution:state:presentcaller_reference:unique test distribution IDdefault_cache_behavior:target_origin_id:'my test origin-000111'forwarded_values:query_string:truecookies:forward:allheaders:- '*'viewer_protocol_policy:allow-allsmooth_streaming:truecompress:trueallowed_methods:items:- GET- HEADcached_methods:- GET- HEADenabled:falselogging:enabled:trueinclude_cookies:falsebucket:mylogbucket.s3.amazonaws.comprefix:myprefix/
1
2
rulesets:- Ansible / AWS # Rules to enforce / AWS.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.