-
Notifications
You must be signed in to change notification settings - Fork 397
/
Copy pathcloudfront_distribution.py
2526 lines (2388 loc) · 103 KB
/
cloudfront_distribution.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r"""
---
version_added: 1.0.0
module: cloudfront_distribution
short_description: Create, update and delete AWS CloudFront distributions
description:
- Allows for easy creation, updating and deletion of CloudFront distributions.
author:
- Willem van Ketwich (@wilvk)
- Will Thames (@willthames)
options:
state:
description:
- The desired state of the distribution.
- I(state=present) creates a new distribution or updates an existing distribution.
- I(state=absent) deletes an existing distribution.
choices: ['present', 'absent']
default: 'present'
type: str
distribution_id:
description:
- The ID of the CloudFront distribution.
- This parameter can be exchanged with I(alias) or I(caller_reference) and is used in conjunction with I(e_tag).
type: str
e_tag:
description:
- A unique identifier of a modified or existing distribution. Used in conjunction with I(distribution_id).
- Is determined automatically if not specified.
type: str
caller_reference:
description:
- A unique identifier for creating and updating CloudFront distributions.
- Each caller reference must be unique across all distributions. e.g. a caller reference used in a web
distribution cannot be reused in a streaming distribution. This parameter can be used instead of I(distribution_id)
to reference an existing distribution. If not specified, this defaults to a datetime stamp of the format
C(YYYY-MM-DDTHH:MM:SS.ffffff).
type: str
alias:
description:
- The name of an alias (CNAME) that is used in a distribution. This is used to effectively reference a distribution by its alias as an alias can only
be used by one distribution per AWS account. This variable avoids having to provide the I(distribution_id) as well as
the I(e_tag), or I(caller_reference) of an existing distribution.
type: str
aliases:
description:
- A list of domain name aliases (CNAMEs) as strings to be used for the distribution.
- Each alias must be unique across all distribution for the AWS account.
type: list
elements: str
default: []
purge_aliases:
description:
- Specifies whether existing aliases will be removed before adding new aliases.
- When I(purge_aliases=true), existing aliases are removed and I(aliases) are added.
default: false
type: bool
default_root_object:
description:
- A config element that specifies the path to request when the user requests the origin.
- e.g. if specified as 'index.html', this maps to www.example.com/index.html when www.example.com is called by the user.
- This prevents the entire distribution origin from being exposed at the root.
type: str
default_origin_domain_name:
description:
- The domain name to use for an origin if no I(origins) have been specified.
- Should only be used on a first run of generating a distribution and not on
subsequent runs.
- Should not be used in conjunction with I(distribution_id), I(caller_reference) or I(alias).
type: str
default_origin_path:
description:
- The default origin path to specify for an origin if no I(origins) have been specified. Defaults to empty if not specified.
type: str
origins:
type: list
elements: dict
description:
- A config element that is a list of complex origin objects to be specified for the distribution. Used for creating and updating distributions.
suboptions:
id:
description: A unique identifier for the origin or origin group. I(id) must be unique within the distribution.
type: str
domain_name:
description:
- The domain name which CloudFront will query as the origin.
- For more information see the CloudFront documentation
at U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesDomainName)
type: str
origin_path:
description: Tells CloudFront to request your content from a directory in your Amazon S3 bucket or your custom origin.
type: str
origin_shield:
description: Specify origin shield options for the origin.
type: dict
suboptions:
enabled:
description: Indicate whether you want the origin to have Origin Shield enabled or not.
type: bool
origin_shield_region:
description: Specify which AWS region will be used for Origin Shield. Required if Origin Shield is enabled.
type: str
version_added: 6.0.0
custom_headers:
description:
- Custom headers you wish to add to the request before passing it to the origin.
- For more information see the CloudFront documentation
at U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/forward-custom-headers.html).
type: list
elements: dict
suboptions:
header_name:
description: The name of a header that you want CloudFront to forward to your origin.
type: str
header_value:
description: The value for the header that you specified in the I(header_name) field.
type: str
s3_origin_access_identity_enabled:
description:
- Use an origin access identity to configure the origin so that viewers can only access objects in an Amazon S3 bucket through CloudFront.
- Will automatically create an Identity for you if no I(s3_origin_config) is specified.
- See also U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html).
type: bool
s3_origin_config:
description: Specify origin access identity for S3 origins.
type: dict
suboptions:
origin_access_identity:
description: Existing origin access identity in the format C(origin-access-identity/cloudfront/OID_ID).
type: str
custom_origin_config:
description: Connection information about the origin.
type: dict
suboptions:
http_port:
description: The HTTP port the custom origin listens on.
type: int
https_port:
description: The HTTPS port the custom origin listens on.
type: int
origin_protocol_policy:
description: The origin protocol policy to apply to your origin.
type: str
origin_ssl_protocols:
description: A list of SSL/TLS protocols that you want CloudFront to use when communicating to the origin over HTTPS.
type: list
elements: str
origin_read_timeout:
description: A timeout (in seconds) when reading from your origin.
type: int
origin_keepalive_timeout:
description: A keep-alive timeout (in seconds).
type: int
connection_attempts:
description: The number of times that CloudFront attempts to connect to the origin.
The minimum number is C(1), the maximum is C(3).
type: int
default: 3
version_added: 6.0.0
connection_timeout:
description: The number of seconds that CloudFront waits when trying to establish a connection to the origin.
The minimum timeout is C(1) second, the maximum is C(10) seconds.
type: int
default: 10
version_added: 6.0.0
purge_origins:
description: Whether to remove any origins that aren't listed in I(origins).
default: false
type: bool
default_cache_behavior:
type: dict
description:
- A dict specifying the default cache behavior of the distribution.
- If not specified, the I(target_origin_id) is defined as the I(target_origin_id) of the first valid
cache_behavior in I(cache_behaviors) with defaults.
suboptions:
target_origin_id:
description:
- The ID of the origin that you want CloudFront to route requests to
by default.
type: str
response_headers_policy_id:
description:
- The ID of the header policy that CloudFront adds to responses that it sends to viewers.
type: str
forwarded_values:
description:
- A dict that specifies how CloudFront handles query strings and cookies.
type: dict
suboptions:
query_string:
description:
- Indicates whether you want CloudFront to forward query strings
to the origin that is associated with this cache behavior.
type: bool
cookies:
description: A dict that specifies whether you want CloudFront to forward cookies to the origin and, if so, which ones.
type: dict
suboptions:
forward:
description:
- Specifies which cookies to forward to the origin for this cache behavior.
- Valid values are C(all), C(none), or C(whitelist).
type: str
whitelisted_names:
type: list
elements: str
description: A list of cookies to forward to the origin for this cache behavior.
headers:
description:
- A list of headers to forward to the origin for this cache behavior.
- To forward all headers use a list containing a single element '*' (C(['*']))
type: list
elements: str
query_string_cache_keys:
description:
- A list that contains the query string parameters you want CloudFront to use as a basis for caching for a cache behavior.
type: list
elements: str
trusted_signers:
description:
- A dict that specifies the AWS accounts that you want to allow to create signed URLs for private content.
type: dict
suboptions:
enabled:
description: Whether you want to require viewers to use signed URLs to access the files specified by I(target_origin_id)
type: bool
items:
description: A list of trusted signers for this cache behavior.
elements: str
type: list
viewer_protocol_policy:
description:
- The protocol that viewers can use to access the files in the origin specified by I(target_origin_id).
- Valid values are C(allow-all), C(redirect-to-https) and C(https-only).
type: str
default_ttl:
description: The default amount of time that you want objects to stay in CloudFront caches.
type: int
max_ttl:
description: The maximum amount of time that you want objects to stay in CloudFront caches.
type: int
min_ttl:
description: The minimum amount of time that you want objects to stay in CloudFront caches.
type: int
allowed_methods:
description: A dict that controls which HTTP methods CloudFront processes and forwards.
type: dict
suboptions:
items:
description: A list of HTTP methods that you want CloudFront to process and forward.
type: list
elements: str
cached_methods:
description:
- A list of HTTP methods that you want CloudFront to apply caching to.
- This can either be C([GET,HEAD]), or C([GET,HEAD,OPTIONS]).
type: list
elements: str
smooth_streaming:
description:
- Whether you want to distribute media files in the Microsoft Smooth Streaming format.
type: bool
compress:
description:
- Whether you want CloudFront to automatically compress files.
type: bool
lambda_function_associations:
description:
- A list of Lambda function associations to use for this cache behavior.
type: list
elements: dict
suboptions:
lambda_function_arn:
description: The ARN of the Lambda function.
type: str
event_type:
description:
- Specifies the event type that triggers a Lambda function invocation.
- This can be C(viewer-request), C(origin-request), C(origin-response) or C(viewer-response).
type: str
field_level_encryption_id:
description:
- The field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data.
type: str
cache_behaviors:
type: list
elements: dict
description:
- A list of dictionaries describing the cache behaviors for the distribution.
- The order of the list is preserved across runs unless I(purge_cache_behaviors) is enabled.
suboptions:
path_pattern:
description:
- The pattern that specifies which requests to apply the behavior to.
type: str
target_origin_id:
description:
- The ID of the origin that you want CloudFront to route requests to
by default.
type: str
response_headers_policy_id:
description:
- The ID of the header policy that CloudFront adds to responses that it sends to viewers.
type: str
forwarded_values:
description:
- A dict that specifies how CloudFront handles query strings and cookies.
type: dict
suboptions:
query_string:
description:
- Indicates whether you want CloudFront to forward query strings
to the origin that is associated with this cache behavior.
type: bool
cookies:
description: A dict that specifies whether you want CloudFront to forward cookies to the origin and, if so, which ones.
type: dict
suboptions:
forward:
description:
- Specifies which cookies to forward to the origin for this cache behavior.
- Valid values are C(all), C(none), or C(whitelist).
type: str
whitelisted_names:
type: list
elements: str
description: A list of cookies to forward to the origin for this cache behavior.
headers:
description:
- A list of headers to forward to the origin for this cache behavior.
- To forward all headers use a list containing a single element '*' (C(['*']))
type: list
elements: str
query_string_cache_keys:
description:
- A list that contains the query string parameters you want CloudFront to use as a basis for caching for a cache behavior.
type: list
elements: str
trusted_signers:
description:
- A dict that specifies the AWS accounts that you want to allow to create signed URLs for private content.
type: dict
suboptions:
enabled:
description: Whether you want to require viewers to use signed URLs to access the files specified by I(path_pattern) and I(target_origin_id)
type: bool
items:
description: A list of trusted signers for this cache behavior.
elements: str
type: list
viewer_protocol_policy:
description:
- The protocol that viewers can use to access the files in the origin specified by I(target_origin_id) when a request matches I(path_pattern).
- Valid values are C(allow-all), C(redirect-to-https) and C(https-only).
type: str
default_ttl:
description: The default amount of time that you want objects to stay in CloudFront caches.
type: int
max_ttl:
description: The maximum amount of time that you want objects to stay in CloudFront caches.
type: int
min_ttl:
description: The minimum amount of time that you want objects to stay in CloudFront caches.
type: int
allowed_methods:
description: A dict that controls which HTTP methods CloudFront processes and forwards.
type: dict
suboptions:
items:
description: A list of HTTP methods that you want CloudFront to process and forward.
type: list
elements: str
cached_methods:
description:
- A list of HTTP methods that you want CloudFront to apply caching to.
- This can either be C([GET,HEAD]), or C([GET,HEAD,OPTIONS]).
type: list
elements: str
smooth_streaming:
description:
- Whether you want to distribute media files in the Microsoft Smooth Streaming format.
type: bool
compress:
description:
- Whether you want CloudFront to automatically compress files.
type: bool
lambda_function_associations:
description:
- A list of Lambda function associations to use for this cache behavior.
type: list
elements: dict
suboptions:
lambda_function_arn:
description: The ARN of the Lambda function.
type: str
event_type:
description:
- Specifies the event type that triggers a Lambda function invocation.
- This can be C(viewer-request), C(origin-request), C(origin-response) or C(viewer-response).
type: str
field_level_encryption_id:
description:
- The field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data.
type: str
purge_cache_behaviors:
description:
- Whether to remove any cache behaviors that aren't listed in I(cache_behaviors).
- This switch also allows the reordering of I(cache_behaviors).
default: false
type: bool
custom_error_responses:
type: list
elements: dict
description:
- A config element that is a I(list[]) of complex custom error responses to be specified for the distribution.
- This attribute configures custom http error messages returned to the user.
suboptions:
error_code:
type: int
description: The error code the custom error page is for.
error_caching_min_ttl:
type: int
description: The length of time (in seconds) that CloudFront will cache status codes for.
response_code:
type: int
description:
- The HTTP status code that CloudFront should return to a user when the origin returns the HTTP status code specified by I(error_code).
response_page_path:
type: str
description:
- The path to the custom error page that you want CloudFront to return to a viewer when your origin returns
the HTTP status code specified by I(error_code).
purge_custom_error_responses:
description: Whether to remove any custom error responses that aren't listed in I(custom_error_responses).
default: false
type: bool
comment:
description:
- A comment that describes the CloudFront distribution.
- If not specified, it defaults to a generic message that it has been created with Ansible, and a datetime stamp.
type: str
logging:
description:
- A config element that is a complex object that defines logging for the distribution.
suboptions:
enabled:
description: When I(enabled=true) CloudFront will log access to an S3 bucket.
type: bool
include_cookies:
description: When I(include_cookies=true) CloudFront will include cookies in the logs.
type: bool
bucket:
description: The S3 bucket to store the log in.
type: str
prefix:
description: A prefix to include in the S3 object names.
type: str
type: dict
price_class:
description:
- A string that specifies the pricing class of the distribution. As per
U(https://aws.amazon.com/cloudfront/pricing/)
- I(price_class=PriceClass_100) consists of the areas United States, Canada and Europe.
- I(price_class=PriceClass_200) consists of the areas United States, Canada, Europe, Japan, India,
Hong Kong, Philippines, S. Korea, Singapore & Taiwan.
- I(price_class=PriceClass_All) consists of the areas United States, Canada, Europe, Japan, India,
South America, Australia, Hong Kong, Philippines, S. Korea, Singapore & Taiwan.
- AWS defaults this to C(PriceClass_All).
- Valid values are C(PriceClass_100), C(PriceClass_200) and C(PriceClass_All)
type: str
enabled:
description:
- A boolean value that specifies whether the distribution is enabled or disabled.
- Defaults to C(false).
type: bool
viewer_certificate:
type: dict
description:
- A dict that specifies the encryption details of the distribution.
suboptions:
cloudfront_default_certificate:
type: bool
description:
- If you're using the CloudFront domain name for your distribution, such as C(123456789abcde.cloudfront.net)
you should set I(cloudfront_default_certificate=true).
- If I(cloudfront_default_certificate=true) do not set I(ssl_support_method).
iam_certificate_id:
type: str
description:
- The ID of a certificate stored in IAM to use for HTTPS connections.
- If I(iam_certificate_id) is set then you must also specify I(ssl_support_method).
acm_certificate_arn:
type: str
description:
- The ID of a certificate stored in ACM to use for HTTPS connections.
- If I(acm_certificate_id) is set then you must also specify I(ssl_support_method).
ssl_support_method:
type: str
description:
- How CloudFront should serve SSL certificates.
- Valid values are C(sni-only) for SNI, and C(vip) if CloudFront is configured to use a dedicated IP for your content.
minimum_protocol_version:
type: str
description:
- The security policy that you want CloudFront to use for HTTPS connections.
- See U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html)
for supported security policies.
restrictions:
type: dict
description:
- A config element that is a complex object that describes how a distribution should restrict it's content.
suboptions:
geo_restriction:
description: Apply a restriction based on the location of the requester.
type: dict
suboptions:
restriction_type:
type: str
description:
- The method that you want to use to restrict distribution of your content by country.
- Valid values are C(none), C(whitelist), C(blacklist).
items:
description:
- A list of ISO 3166-1 two letter (Alpha 2) country codes that the
restriction should apply to.
- 'See the ISO website for a full list of codes U(https://www.iso.org/obp/ui/#search/code/).'
type: list
elements: str
web_acl_id:
description:
- The ID of a Web Application Firewall (WAF) Access Control List (ACL).
type: str
http_version:
description:
- The version of the http protocol to use for the distribution.
- AWS defaults this to C(http2).
- Valid values are C(http1.1), C(http2), C(http3) and C(http2and3).
type: str
ipv6_enabled:
description:
- Determines whether IPv6 support is enabled or not.
- Defaults to C(false).
type: bool
wait:
description:
- Specifies whether the module waits until the distribution has completed processing the creation or update.
type: bool
default: false
wait_timeout:
description:
- Specifies the duration in seconds to wait for a timeout of a cloudfront create or update.
default: 1800
type: int
extends_documentation_fragment:
- amazon.aws.common.modules
- amazon.aws.region.modules
- amazon.aws.tags
- amazon.aws.boto3
"""
EXAMPLES = r"""
- 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
"""
RETURN = r"""
active_trusted_signers:
description: Key pair IDs that CloudFront is aware of for each trusted signer.
returned: always
type: complex
contains:
enabled:
description: Whether trusted signers are in use.
returned: always
type: bool
sample: false
quantity:
description: Number of trusted signers.
returned: always
type: int
sample: 1
items:
description: Number of trusted signers.
returned: when there are trusted signers
type: list
sample:
- key_pair_id
aliases:
description: Aliases that refer to the distribution.
returned: always
type: complex
contains:
items:
description: List of aliases.
returned: always
type: list
sample:
- test.example.com
quantity:
description: Number of aliases.
returned: always
type: int
sample: 1
arn:
description: Amazon Resource Name of the distribution.
returned: always
type: str
sample: arn:aws:cloudfront::123456789012:distribution/E1234ABCDEFGHI
cache_behaviors:
description: CloudFront cache behaviors.
returned: always
type: complex
contains:
items:
description: List of cache behaviors.
returned: always
type: complex
contains:
allowed_methods:
description: Methods allowed by the cache behavior.
returned: always
type: complex
contains:
cached_methods:
description: Methods cached by the cache behavior.
returned: always
type: complex
contains:
items:
description: List of cached methods.
returned: always
type: list
sample:
- HEAD
- GET
quantity:
description: Count of cached methods.
returned: always
type: int
sample: 2
items:
description: List of methods allowed by the cache behavior.
returned: always
type: list
sample:
- HEAD
- GET
quantity:
description: Count of methods allowed by the cache behavior.
returned: always
type: int
sample: 2
compress:
description: Whether compression is turned on for the cache behavior.
returned: always
type: bool
sample: false
default_ttl:
description: Default Time to Live of the cache behavior.
returned: always
type: int
sample: 86400
forwarded_values:
description: Values forwarded to the origin for this cache behavior.
returned: always
type: complex
contains:
cookies:
description: Cookies to forward to the origin.
returned: always
type: complex
contains:
forward:
description: Which cookies to forward to the origin for this cache behavior.
returned: always
type: str
sample: none
whitelisted_names:
description: The names of the cookies to forward to the origin for this cache behavior.
returned: when I(forward=whitelist)
type: complex
contains:
quantity:
description: Count of cookies to forward.
returned: always
type: int
sample: 1
items:
description: List of cookies to forward.
returned: when list is not empty
type: list
sample: my_cookie
headers:
description: Which headers are used to vary on cache retrievals.
returned: always
type: complex
contains:
quantity:
description: Count of headers to vary on.
returned: always
type: int
sample: 1
items:
description: List of headers to vary on.
returned: when list is not empty
type: list
sample:
- Host
query_string:
description: Whether the query string is used in cache lookups.
returned: always
type: bool
sample: false
query_string_cache_keys:
description: Which query string keys to use in cache lookups.
returned: always
type: complex
contains:
quantity:
description: Count of query string cache keys to use in cache lookups.
returned: always
type: int
sample: 1
items:
description: List of query string cache keys to use in cache lookups.
returned: when list is not empty
type: list
sample:
lambda_function_associations:
description: Lambda function associations for a cache behavior.
returned: always
type: complex
contains:
quantity:
description: Count of lambda function associations.
returned: always
type: int
sample: 1
items:
description: List of lambda function associations.
returned: when list is not empty
type: list
sample:
- lambda_function_arn: arn:aws:lambda:123456789012:us-east-1/lambda/lambda-function
event_type: viewer-response
max_ttl:
description: Maximum Time to Live.
returned: always
type: int
sample: 31536000
min_ttl:
description: Minimum Time to Live.
returned: always
type: int
sample: 0
path_pattern:
description: Path pattern that determines this cache behavior.
returned: always
type: str
sample: /path/to/files/*
smooth_streaming:
description: Whether smooth streaming is enabled.
returned: always
type: bool
sample: false
target_origin_id:
description: ID of origin reference by this cache behavior.
returned: always
type: str
sample: origin_abcd
trusted_signers:
description: Trusted signers.
returned: always
type: complex
contains:
enabled:
description: Whether trusted signers are enabled for this cache behavior.
returned: always
type: bool
sample: false
quantity:
description: Count of trusted signers.
returned: always
type: int
sample: 1
viewer_protocol_policy:
description: Policy of how to handle http/https.
returned: always
type: str
sample: redirect-to-https
quantity:
description: Count of cache behaviors.
returned: always
type: int
sample: 1
caller_reference:
description: Idempotency reference given when creating CloudFront distribution.
returned: always
type: str
sample: '1484796016700'
comment:
description: Any comments you want to include about the distribution.
returned: always
type: str
sample: 'my first CloudFront distribution'
custom_error_responses:
description: Custom error responses to use for error handling.
returned: always
type: complex
contains:
items:
description: List of custom error responses.
returned: always
type: complex
contains:
error_caching_min_ttl:
description: Minimum time to cache this error response.
returned: always
type: int
sample: 300
error_code:
description: Origin response code that triggers this error response.
returned: always
type: int
sample: 500
response_code:
description: Response code to return to the requester.
returned: always
type: str
sample: '500'
response_page_path:
description: Path that contains the error page to display.
returned: always
type: str
sample: /errors/5xx.html
quantity:
description: Count of custom error response items
returned: always
type: int
sample: 1
default_cache_behavior:
description: Default cache behavior.
returned: always
type: complex
contains:
allowed_methods:
description: Methods allowed by the cache behavior.
returned: always
type: complex
contains:
cached_methods:
description: Methods cached by the cache behavior.
returned: always
type: complex
contains:
items:
description: List of cached methods.
returned: always
type: list
sample:
- HEAD
- GET
quantity:
description: Count of cached methods.
returned: always
type: int
sample: 2
items:
description: List of methods allowed by the cache behavior.
returned: always
type: list
sample: