cloudfront_distribution
Create, update and delete AWS CloudFront distributions
Collection: community.aws
Full Name: community.aws.cloudfront_distribution
Synopsis
Create, update and delete AWS CloudFront distributions
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| access_key | str | |||
| alias | str | |||
| aliases | list | [] | ||
| aws_ca_bundle | path | |||
| aws_config | dict | |||
| cache_behaviors | list | |||
| caller_reference | str | |||
| comment | str | |||
| custom_error_responses | list | |||
| debug_botocore_endpoint_logs | bool | false | ||
| default_cache_behavior | dict | |||
| default_origin_domain_name | str | |||
| default_origin_path | str | |||
| default_root_object | str | |||
| distribution_id | str | |||
| e_tag | str | |||
| enabled | bool | |||
| endpoint_url | str | |||
| http_version | str | |||
| ipv6_enabled | bool | |||
| logging | dict | |||
| origins | list | |||
| price_class | str | |||
| profile | str | |||
| purge_aliases | bool | false | ||
| purge_cache_behaviors | bool | false | ||
| purge_custom_error_responses | bool | false | ||
| purge_origins | bool | false | ||
| purge_tags | bool | true | ||
| region | str | |||
| restrictions | dict | |||
| secret_key | str | |||
| session_token | str | |||
| state | str | present | ||
| tags | dict | |||
| validate_certs | bool | true | ||
| viewer_certificate | dict | |||
| wait | bool | false | ||
| wait_timeout | int | 1800 | ||
| web_acl_id | str |
Example
yaml
- name: create a basic distribution with defaults and tags
community.aws.cloudfront_distribution:
state: present
default_origin_domain_name: www.my-cloudfront-origin.com
tags:
Name: example distribution
Project: example project
Priority: '1'
- name: update a distribution comment by distribution_id
community.aws.cloudfront_distribution:
state: present
distribution_id: E1RP5A2MJ8073O
comment: modified by ansible cloudfront.py
- name: update a distribution comment by caller_reference
community.aws.cloudfront_distribution:
state: present
caller_reference: my cloudfront distribution 001
comment: modified by ansible cloudfront.py
- name: update a distribution's aliases and comment using the distribution_id as a reference
community.aws.cloudfront_distribution:
state: present
distribution_id: E1RP5A2MJ8073O
comment: modified by cloudfront.py again
aliases:
- 'www.my-distribution-source.com'
- 'zzz.aaa.io'
- name: update a distribution's aliases and comment using an alias as a reference
community.aws.cloudfront_distribution:
state: present
caller_reference: my test distribution
comment: modified by cloudfront.py again
aliases:
- www.my-distribution-source.com
- zzz.aaa.io
- name: update a distribution's comment and aliases and tags and remove existing tags
community.aws.cloudfront_distribution:
state: present
distribution_id: E15BU8SDCGSG57
comment: modified by cloudfront.py again
aliases:
- tested.com
tags:
Project: distribution 1.2
purge_tags: true
- name: create a distribution with an origin, logging and default cache behavior
community.aws.cloudfront_distribution:
state: present
caller_reference: unique test distribution ID
origins:
- id: 'my test origin-000111'
domain_name: www.example.com
origin_path: /production
custom_headers:
- header_name: MyCustomHeaderName
header_value: MyCustomHeaderValue
default_cache_behavior:
target_origin_id: 'my test origin-000111'
forwarded_values:
query_string: true
cookies:
forward: all
headers:
- '*'
viewer_protocol_policy: allow-all
smooth_streaming: true
compress: true
allowed_methods:
items:
- GET
- HEAD
cached_methods:
- GET
- HEAD
logging:
enabled: true
include_cookies: false
bucket: mylogbucket.s3.amazonaws.com
prefix: myprefix/
enabled: false
comment: this is a CloudFront distribution with logging
- name: delete a distribution
community.aws.cloudfront_distribution:
state: absent
caller_reference: replaceable distribution