aws-cdk-lib 2.204.0__py3-none-any.whl → 2.205.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aws-cdk-lib might be problematic. Click here for more details.

Files changed (48) hide show
  1. aws_cdk/__init__.py +170 -92
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.204.0.jsii.tgz → aws-cdk-lib@2.205.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_aiops/__init__.py +89 -39
  5. aws_cdk/aws_applicationautoscaling/__init__.py +2 -2
  6. aws_cdk/aws_arczonalshift/__init__.py +4 -1
  7. aws_cdk/aws_b2bi/__init__.py +32 -16
  8. aws_cdk/aws_bedrock/__init__.py +198 -10
  9. aws_cdk/aws_cassandra/__init__.py +156 -0
  10. aws_cdk/aws_cloudformation/__init__.py +74 -72
  11. aws_cdk/aws_cloudfront/__init__.py +1181 -485
  12. aws_cdk/aws_cloudfront_origins/__init__.py +26 -21
  13. aws_cdk/aws_cloudwatch/__init__.py +61 -0
  14. aws_cdk/aws_codebuild/__init__.py +216 -36
  15. aws_cdk/aws_datasync/__init__.py +2 -2
  16. aws_cdk/aws_docdb/__init__.py +78 -0
  17. aws_cdk/aws_dynamodb/__init__.py +207 -35
  18. aws_cdk/aws_ec2/__init__.py +32 -30
  19. aws_cdk/aws_ecs/__init__.py +12 -19
  20. aws_cdk/aws_emrserverless/__init__.py +5 -5
  21. aws_cdk/aws_events/__init__.py +58 -3
  22. aws_cdk/aws_events_targets/__init__.py +7 -2
  23. aws_cdk/aws_evs/__init__.py +7 -7
  24. aws_cdk/aws_fsx/__init__.py +138 -78
  25. aws_cdk/aws_gamelift/__init__.py +19 -0
  26. aws_cdk/aws_glue/__init__.py +3 -3
  27. aws_cdk/aws_iot/__init__.py +1 -1
  28. aws_cdk/aws_kinesis/__init__.py +67 -13
  29. aws_cdk/aws_kinesisfirehose/__init__.py +28 -1
  30. aws_cdk/aws_lex/__init__.py +36 -19
  31. aws_cdk/aws_neptune/__init__.py +12 -12
  32. aws_cdk/aws_odb/__init__.py +4049 -0
  33. aws_cdk/aws_omics/__init__.py +1 -1
  34. aws_cdk/aws_qbusiness/__init__.py +471 -4
  35. aws_cdk/aws_quicksight/__init__.py +185 -16
  36. aws_cdk/aws_rds/__init__.py +169 -17
  37. aws_cdk/aws_redshiftserverless/__init__.py +72 -45
  38. aws_cdk/aws_route53/__init__.py +41 -19
  39. aws_cdk/aws_s3tables/__init__.py +1005 -0
  40. aws_cdk/aws_sagemaker/__init__.py +20 -0
  41. aws_cdk/aws_synthetics/__init__.py +141 -37
  42. aws_cdk/aws_transfer/__init__.py +23 -1
  43. {aws_cdk_lib-2.204.0.dist-info → aws_cdk_lib-2.205.0.dist-info}/METADATA +1 -1
  44. {aws_cdk_lib-2.204.0.dist-info → aws_cdk_lib-2.205.0.dist-info}/RECORD +48 -47
  45. {aws_cdk_lib-2.204.0.dist-info → aws_cdk_lib-2.205.0.dist-info}/LICENSE +0 -0
  46. {aws_cdk_lib-2.204.0.dist-info → aws_cdk_lib-2.205.0.dist-info}/NOTICE +0 -0
  47. {aws_cdk_lib-2.204.0.dist-info → aws_cdk_lib-2.205.0.dist-info}/WHEEL +0 -0
  48. {aws_cdk_lib-2.204.0.dist-info → aws_cdk_lib-2.205.0.dist-info}/top_level.txt +0 -0
@@ -70,6 +70,299 @@ cloudfront.Distribution(self, "myDist",
70
70
  )
71
71
  ```
72
72
 
73
+ ### CloudFront SaaS Manager resources
74
+
75
+ #### Multi-tenant distribution and tenant providing ACM certificates
76
+
77
+ You can use Cloudfront to build multi-tenant distributions to house applications.
78
+
79
+ To create a multi-tenant distribution w/parameters, create a Distribution construct, and then update DistributionConfig in the CfnDistribution to use connectionMode: "tenant-only"
80
+
81
+ Then create a tenant
82
+
83
+ ```python
84
+ # Create the simple Origin
85
+ my_bucket = s3.Bucket(self, "myBucket")
86
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
87
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
88
+ )
89
+
90
+ # Create the Distribution construct
91
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "distribution",
92
+ default_behavior=cloudfront.BehaviorOptions(
93
+ origin=s3_origin
94
+ ),
95
+ default_root_object="index.html"
96
+ )
97
+
98
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
99
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
100
+
101
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
102
+ target_origin_id=my_bucket.bucket_arn,
103
+ viewer_protocol_policy="allow-all",
104
+ compress=False,
105
+ allowed_methods=["GET", "HEAD"],
106
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
107
+ )
108
+ # Create the updated distributionConfig
109
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
110
+ default_cache_behavior=default_cache_behavior,
111
+ enabled=True,
112
+ # the properties below are optional
113
+ connection_mode="tenant-only",
114
+ origins=[cloudfront.CfnDistribution.OriginProperty(
115
+ id=my_bucket.bucket_arn,
116
+ domain_name=my_bucket.bucket_domain_name,
117
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
118
+ origin_path="/{{tenantName}}"
119
+ )
120
+ ],
121
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
122
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
123
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
124
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
125
+ required=False,
126
+ # the properties below are optional
127
+ comment="tenantName",
128
+ default_value="root"
129
+ )
130
+ ),
131
+ name="tenantName"
132
+ )
133
+ ]
134
+ )
135
+ )
136
+
137
+ # Override the distribution configuration to enable multi-tenancy.
138
+ cfn_distribution.distribution_config = distribution_config
139
+
140
+ # Create a distribution tenant using an existing ACM certificate
141
+ cfn_distribution_tenant = cloudfront.CfnDistributionTenant(self, "distribution-tenant",
142
+ distribution_id=my_multi_tenant_distribution.distribution_id,
143
+ domains=["my-tenant.my.domain.com"],
144
+ name="my-tenant",
145
+ enabled=True,
146
+ parameters=[cloudfront.CfnDistributionTenant.ParameterProperty(
147
+ name="tenantName",
148
+ value="app"
149
+ )],
150
+ customizations=cloudfront.CfnDistributionTenant.CustomizationsProperty(
151
+ certificate=cloudfront.CfnDistributionTenant.CertificateProperty(
152
+ arn="REPLACE_WITH_ARN"
153
+ )
154
+ )
155
+ )
156
+ ```
157
+
158
+ #### Multi-tenant distribution and tenant with CloudFront-hosted certificate
159
+
160
+ A distribution tenant with CloudFront-hosted domain validation is useful if you don't currently have traffic to the domain.
161
+
162
+ Start by creating a parent multi-tenant distribution, then create the distribution tenant.
163
+
164
+ ```python
165
+ import aws_cdk.aws_route53 as route53
166
+
167
+
168
+ # Create the simple Origin
169
+ my_bucket = s3.Bucket(self, "myBucket")
170
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
171
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
172
+ )
173
+
174
+ # Create the Distribution construct
175
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
176
+ default_behavior=cloudfront.BehaviorOptions(
177
+ origin=s3_origin
178
+ ),
179
+ default_root_object="index.html"
180
+ )
181
+
182
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
183
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
184
+
185
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
186
+ target_origin_id=my_bucket.bucket_arn,
187
+ viewer_protocol_policy="allow-all",
188
+ compress=False,
189
+ allowed_methods=["GET", "HEAD"],
190
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
191
+ )
192
+ # Create the updated distributionConfig
193
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
194
+ default_cache_behavior=default_cache_behavior,
195
+ enabled=True,
196
+ # the properties below are optional
197
+ connection_mode="tenant-only",
198
+ origins=[cloudfront.CfnDistribution.OriginProperty(
199
+ id=my_bucket.bucket_arn,
200
+ domain_name=my_bucket.bucket_domain_name,
201
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
202
+ origin_path="/{{tenantName}}"
203
+ )
204
+ ],
205
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
206
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
207
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
208
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
209
+ required=False,
210
+ # the properties below are optional
211
+ comment="tenantName",
212
+ default_value="root"
213
+ )
214
+ ),
215
+ name="tenantName"
216
+ )
217
+ ]
218
+ )
219
+ )
220
+
221
+ # Override the distribution configuration to enable multi-tenancy.
222
+ cfn_distribution.distribution_config = distribution_config
223
+
224
+ # Create a connection group and a cname record in an existing hosted zone to validate domain ownership
225
+ connection_group = cloudfront.CfnConnectionGroup(self, "cf-hosted-connection-group",
226
+ enabled=True,
227
+ ipv6_enabled=True,
228
+ name="my-connection-group"
229
+ )
230
+
231
+ # Import the existing hosted zone info, replacing with your hostedZoneId and zoneName
232
+ hosted_zone_id = "YOUR_HOSTED_ZONE_ID"
233
+ zone_name = "my.domain.com"
234
+ hosted_zone = route53.HostedZone.from_hosted_zone_attributes(self, "hosted-zone",
235
+ hosted_zone_id=hosted_zone_id,
236
+ zone_name=zone_name
237
+ )
238
+
239
+ record = route53.CnameRecord(self, "cname-record",
240
+ domain_name=connection_group.attr_routing_endpoint,
241
+ zone=hosted_zone,
242
+ record_name="cf-hosted-tenant.my.domain.com"
243
+ )
244
+
245
+ # Create the cloudfront-hosted tenant, passing in the previously created connection group
246
+ cloudfront_hosted_tenant = cloudfront.CfnDistributionTenant(self, "cf-hosted-tenant",
247
+ distribution_id=my_multi_tenant_distribution.distribution_id,
248
+ name="cf-hosted-tenant",
249
+ domains=["cf-hosted-tenant.my.domain.com"],
250
+ connection_group_id=connection_group.attr_id,
251
+ enabled=True,
252
+ managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
253
+ validation_token_host="cloudfront"
254
+ )
255
+ )
256
+ ```
257
+
258
+ #### Multi-tenant distribution and tenant with self-hosted certificate
259
+
260
+ A tenant with self-hosted domain validation is useful if you already have traffic to the domain and can't tolerate downtime during migration to multi-tenant architecture.
261
+
262
+ The tenant will be created, and the managed certificate will be awaiting validation of domain ownership. You can then validate domain ownership via http redirect or token file upload. [More details here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managed-cloudfront-certificates.html#complete-domain-ownership)
263
+
264
+ Traffic won't be migrated until you update your hosted zone to point the tenant domain to the CloudFront RoutingEndpoint.
265
+
266
+ Start by creating a parent multi-tenant distribution
267
+
268
+ ```python
269
+ # Create the simple Origin
270
+ my_bucket = s3.Bucket(self, "myBucket")
271
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
272
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
273
+ )
274
+
275
+ # Create the Distribution construct
276
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
277
+ default_behavior=cloudfront.BehaviorOptions(
278
+ origin=s3_origin
279
+ ),
280
+ default_root_object="index.html"
281
+ )
282
+
283
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
284
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
285
+
286
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
287
+ target_origin_id=my_bucket.bucket_arn,
288
+ viewer_protocol_policy="allow-all",
289
+ compress=False,
290
+ allowed_methods=["GET", "HEAD"],
291
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
292
+ )
293
+ # Create the updated distributionConfig
294
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
295
+ default_cache_behavior=default_cache_behavior,
296
+ enabled=True,
297
+ # the properties below are optional
298
+ connection_mode="tenant-only",
299
+ origins=[cloudfront.CfnDistribution.OriginProperty(
300
+ id=my_bucket.bucket_arn,
301
+ domain_name=my_bucket.bucket_domain_name,
302
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
303
+ origin_path="/{{tenantName}}"
304
+ )
305
+ ],
306
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
307
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
308
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
309
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
310
+ required=False,
311
+ # the properties below are optional
312
+ comment="tenantName",
313
+ default_value="root"
314
+ )
315
+ ),
316
+ name="tenantName"
317
+ )
318
+ ]
319
+ )
320
+ )
321
+
322
+ # Override the distribution configuration to enable multi-tenancy.
323
+ cfn_distribution.distribution_config = distribution_config
324
+
325
+ # Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
326
+ connection_group = cloudfront.CfnConnectionGroup(self, "self-hosted-connection-group",
327
+ enabled=True,
328
+ ipv6_enabled=True,
329
+ name="self-hosted-connection-group"
330
+ )
331
+
332
+ # Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
333
+ CfnOutput(self, "RoutingEndpoint",
334
+ value=connection_group.attr_routing_endpoint,
335
+ description="CloudFront Routing Endpoint to be added to my hosted zone CNAME records"
336
+ )
337
+
338
+ # Create a distribution tenant with a self-hosted domain.
339
+ self_hosted_tenant = cloudfront.CfnDistributionTenant(self, "self-hosted-tenant",
340
+ distribution_id=my_multi_tenant_distribution.distribution_id,
341
+ connection_group_id=connection_group.attr_id,
342
+ name="self-hosted-tenant",
343
+ domains=["self-hosted-tenant.my.domain.com"],
344
+ enabled=True,
345
+ managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
346
+ primary_domain_name="self-hosted-tenant.my.domain.com",
347
+ validation_token_host="self-hosted"
348
+ )
349
+ )
350
+ ```
351
+
352
+ While CDK is deploying, it will attempt to validate domain ownership by confirming that a validation token is served directly from your domain, or via http redirect.
353
+
354
+ [follow the steps here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managed-cloudfront-certificates.html#complete-domain-ownership) to complete domain setup before deploying this CDK stack, or while CDK is in the waiting state during tenant creation. Refer to the section "I have existing traffic"
355
+
356
+ A simple option for validating via http redirect, would be to add a rewrite rule like so to your server (Apache in this example)
357
+
358
+ ```
359
+ RewriteEngine On
360
+ RewriteCond %{REQUEST_URI} ^/\.well-known/pki-validation/(.+)$ [NC]
361
+ RewriteRule ^(.*)$ https://validation.us-east-1.acm-validations.aws/%{ENV:AWS_ACCOUNT_ID}/.well-known/pki-validation/%1 [R=301,L]
362
+ ```
363
+
364
+ Then, when you are ready to accept traffic, follow the steps [here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managed-cloudfront-certificates.html#point-domains-to-cloudfront) using the RoutingEndpoint from above to configure DNS to point to CloudFront.
365
+
73
366
  ### VPC origins
74
367
 
75
368
  You can use CloudFront to deliver content from applications that are hosted in your virtual private cloud (VPC) private subnets.
@@ -558,7 +851,7 @@ function_version = lambda_.Version.from_version_arn(self, "Version", "arn:aws:la
558
851
 
559
852
  cloudfront.Distribution(self, "distro",
560
853
  default_behavior=cloudfront.BehaviorOptions(
561
- origin=origins.S3Origin(s3_bucket),
854
+ origin=origins.S3BucketOrigin.with_origin_access_control(s3_bucket),
562
855
  edge_lambdas=[cloudfront.EdgeLambda(
563
856
  function_version=function_version,
564
857
  event_type=cloudfront.LambdaEdgeEventType.VIEWER_REQUEST
@@ -1402,8 +1695,78 @@ class AccessLevel(enum.Enum):
1402
1695
 
1403
1696
  Example::
1404
1697
 
1698
+ # Create the simple Origin
1405
1699
  my_bucket = s3.Bucket(self, "myBucket")
1406
- s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket, origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.READ_VERSIONED, cloudfront.AccessLevel.WRITE, cloudfront.AccessLevel.DELETE])
1700
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
1701
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
1702
+ )
1703
+
1704
+ # Create the Distribution construct
1705
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "distribution",
1706
+ default_behavior=cloudfront.BehaviorOptions(
1707
+ origin=s3_origin
1708
+ ),
1709
+ default_root_object="index.html"
1710
+ )
1711
+
1712
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
1713
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
1714
+
1715
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
1716
+ target_origin_id=my_bucket.bucket_arn,
1717
+ viewer_protocol_policy="allow-all",
1718
+ compress=False,
1719
+ allowed_methods=["GET", "HEAD"],
1720
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
1721
+ )
1722
+ # Create the updated distributionConfig
1723
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
1724
+ default_cache_behavior=default_cache_behavior,
1725
+ enabled=True,
1726
+ # the properties below are optional
1727
+ connection_mode="tenant-only",
1728
+ origins=[cloudfront.CfnDistribution.OriginProperty(
1729
+ id=my_bucket.bucket_arn,
1730
+ domain_name=my_bucket.bucket_domain_name,
1731
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
1732
+ origin_path="/{{tenantName}}"
1733
+ )
1734
+ ],
1735
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
1736
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
1737
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
1738
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
1739
+ required=False,
1740
+ # the properties below are optional
1741
+ comment="tenantName",
1742
+ default_value="root"
1743
+ )
1744
+ ),
1745
+ name="tenantName"
1746
+ )
1747
+ ]
1748
+ )
1749
+ )
1750
+
1751
+ # Override the distribution configuration to enable multi-tenancy.
1752
+ cfn_distribution.distribution_config = distribution_config
1753
+
1754
+ # Create a distribution tenant using an existing ACM certificate
1755
+ cfn_distribution_tenant = cloudfront.CfnDistributionTenant(self, "distribution-tenant",
1756
+ distribution_id=my_multi_tenant_distribution.distribution_id,
1757
+ domains=["my-tenant.my.domain.com"],
1758
+ name="my-tenant",
1759
+ enabled=True,
1760
+ parameters=[cloudfront.CfnDistributionTenant.ParameterProperty(
1761
+ name="tenantName",
1762
+ value="app"
1763
+ )],
1764
+ customizations=cloudfront.CfnDistributionTenant.CustomizationsProperty(
1765
+ certificate=cloudfront.CfnDistributionTenant.CertificateProperty(
1766
+ arn="REPLACE_WITH_ARN"
1767
+ )
1768
+ )
1769
+ )
1407
1770
  '''
1408
1771
 
1409
1772
  READ = "READ"
@@ -2098,17 +2461,20 @@ class BehaviorOptions(AddBehaviorOptions):
2098
2461
 
2099
2462
  Example::
2100
2463
 
2101
- # Creates a distribution from an Application Load Balancer
2102
- # vpc: ec2.Vpc
2103
-
2104
- # Create an application load balancer in a VPC. 'internetFacing' can be 'false'.
2105
- alb = elbv2.ApplicationLoadBalancer(self, "ALB",
2106
- vpc=vpc,
2107
- internet_facing=False,
2108
- vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_ISOLATED)
2464
+ # s3_bucket: s3.Bucket
2465
+ # Add a cloudfront Function to a Distribution
2466
+ cf_function = cloudfront.Function(self, "Function",
2467
+ code=cloudfront.FunctionCode.from_inline("function handler(event) { return event.request }"),
2468
+ runtime=cloudfront.FunctionRuntime.JS_2_0
2109
2469
  )
2110
- cloudfront.Distribution(self, "myDist",
2111
- default_behavior=cloudfront.BehaviorOptions(origin=origins.VpcOrigin.with_application_load_balancer(alb))
2470
+ cloudfront.Distribution(self, "distro",
2471
+ default_behavior=cloudfront.BehaviorOptions(
2472
+ origin=origins.S3Origin(s3_bucket),
2473
+ function_associations=[cloudfront.FunctionAssociation(
2474
+ function=cf_function,
2475
+ event_type=cloudfront.FunctionEventType.VIEWER_REQUEST
2476
+ )]
2477
+ )
2112
2478
  )
2113
2479
  '''
2114
2480
  if __debug__:
@@ -4385,25 +4751,100 @@ class CfnConnectionGroup(
4385
4751
 
4386
4752
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-connectiongroup.html
4387
4753
  :cloudformationResource: AWS::CloudFront::ConnectionGroup
4388
- :exampleMetadata: fixture=_generated
4754
+ :exampleMetadata: infused
4389
4755
 
4390
4756
  Example::
4391
4757
 
4392
- # The code below shows an example of how to instantiate this type.
4393
- # The values are placeholders you should change.
4394
- from aws_cdk import aws_cloudfront as cloudfront
4758
+ import aws_cdk.aws_route53 as route53
4395
4759
 
4396
- cfn_connection_group = cloudfront.CfnConnectionGroup(self, "MyCfnConnectionGroup",
4397
- name="name",
4398
4760
 
4761
+ # Create the simple Origin
4762
+ my_bucket = s3.Bucket(self, "myBucket")
4763
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
4764
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
4765
+ )
4766
+
4767
+ # Create the Distribution construct
4768
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
4769
+ default_behavior=cloudfront.BehaviorOptions(
4770
+ origin=s3_origin
4771
+ ),
4772
+ default_root_object="index.html"
4773
+ )
4774
+
4775
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
4776
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
4777
+
4778
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
4779
+ target_origin_id=my_bucket.bucket_arn,
4780
+ viewer_protocol_policy="allow-all",
4781
+ compress=False,
4782
+ allowed_methods=["GET", "HEAD"],
4783
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
4784
+ )
4785
+ # Create the updated distributionConfig
4786
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
4787
+ default_cache_behavior=default_cache_behavior,
4788
+ enabled=True,
4399
4789
  # the properties below are optional
4400
- anycast_ip_list_id="anycastIpListId",
4401
- enabled=False,
4402
- ipv6_enabled=False,
4403
- tags=[CfnTag(
4404
- key="key",
4405
- value="value"
4406
- )]
4790
+ connection_mode="tenant-only",
4791
+ origins=[cloudfront.CfnDistribution.OriginProperty(
4792
+ id=my_bucket.bucket_arn,
4793
+ domain_name=my_bucket.bucket_domain_name,
4794
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
4795
+ origin_path="/{{tenantName}}"
4796
+ )
4797
+ ],
4798
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
4799
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
4800
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
4801
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
4802
+ required=False,
4803
+ # the properties below are optional
4804
+ comment="tenantName",
4805
+ default_value="root"
4806
+ )
4807
+ ),
4808
+ name="tenantName"
4809
+ )
4810
+ ]
4811
+ )
4812
+ )
4813
+
4814
+ # Override the distribution configuration to enable multi-tenancy.
4815
+ cfn_distribution.distribution_config = distribution_config
4816
+
4817
+ # Create a connection group and a cname record in an existing hosted zone to validate domain ownership
4818
+ connection_group = cloudfront.CfnConnectionGroup(self, "cf-hosted-connection-group",
4819
+ enabled=True,
4820
+ ipv6_enabled=True,
4821
+ name="my-connection-group"
4822
+ )
4823
+
4824
+ # Import the existing hosted zone info, replacing with your hostedZoneId and zoneName
4825
+ hosted_zone_id = "YOUR_HOSTED_ZONE_ID"
4826
+ zone_name = "my.domain.com"
4827
+ hosted_zone = route53.HostedZone.from_hosted_zone_attributes(self, "hosted-zone",
4828
+ hosted_zone_id=hosted_zone_id,
4829
+ zone_name=zone_name
4830
+ )
4831
+
4832
+ record = route53.CnameRecord(self, "cname-record",
4833
+ domain_name=connection_group.attr_routing_endpoint,
4834
+ zone=hosted_zone,
4835
+ record_name="cf-hosted-tenant.my.domain.com"
4836
+ )
4837
+
4838
+ # Create the cloudfront-hosted tenant, passing in the previously created connection group
4839
+ cloudfront_hosted_tenant = cloudfront.CfnDistributionTenant(self, "cf-hosted-tenant",
4840
+ distribution_id=my_multi_tenant_distribution.distribution_id,
4841
+ name="cf-hosted-tenant",
4842
+ domains=["cf-hosted-tenant.my.domain.com"],
4843
+ connection_group_id=connection_group.attr_id,
4844
+ enabled=True,
4845
+ managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
4846
+ validation_token_host="cloudfront"
4847
+ )
4407
4848
  )
4408
4849
  '''
4409
4850
 
@@ -4660,25 +5101,100 @@ class CfnConnectionGroupProps:
4660
5101
  :param tags: A complex type that contains zero or more ``Tag`` elements.
4661
5102
 
4662
5103
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-connectiongroup.html
4663
- :exampleMetadata: fixture=_generated
5104
+ :exampleMetadata: infused
4664
5105
 
4665
5106
  Example::
4666
5107
 
4667
- # The code below shows an example of how to instantiate this type.
4668
- # The values are placeholders you should change.
4669
- from aws_cdk import aws_cloudfront as cloudfront
5108
+ import aws_cdk.aws_route53 as route53
4670
5109
 
4671
- cfn_connection_group_props = cloudfront.CfnConnectionGroupProps(
4672
- name="name",
4673
5110
 
5111
+ # Create the simple Origin
5112
+ my_bucket = s3.Bucket(self, "myBucket")
5113
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
5114
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
5115
+ )
5116
+
5117
+ # Create the Distribution construct
5118
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
5119
+ default_behavior=cloudfront.BehaviorOptions(
5120
+ origin=s3_origin
5121
+ ),
5122
+ default_root_object="index.html"
5123
+ )
5124
+
5125
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
5126
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
5127
+
5128
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
5129
+ target_origin_id=my_bucket.bucket_arn,
5130
+ viewer_protocol_policy="allow-all",
5131
+ compress=False,
5132
+ allowed_methods=["GET", "HEAD"],
5133
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
5134
+ )
5135
+ # Create the updated distributionConfig
5136
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
5137
+ default_cache_behavior=default_cache_behavior,
5138
+ enabled=True,
4674
5139
  # the properties below are optional
4675
- anycast_ip_list_id="anycastIpListId",
4676
- enabled=False,
4677
- ipv6_enabled=False,
4678
- tags=[CfnTag(
4679
- key="key",
4680
- value="value"
4681
- )]
5140
+ connection_mode="tenant-only",
5141
+ origins=[cloudfront.CfnDistribution.OriginProperty(
5142
+ id=my_bucket.bucket_arn,
5143
+ domain_name=my_bucket.bucket_domain_name,
5144
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
5145
+ origin_path="/{{tenantName}}"
5146
+ )
5147
+ ],
5148
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
5149
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
5150
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
5151
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
5152
+ required=False,
5153
+ # the properties below are optional
5154
+ comment="tenantName",
5155
+ default_value="root"
5156
+ )
5157
+ ),
5158
+ name="tenantName"
5159
+ )
5160
+ ]
5161
+ )
5162
+ )
5163
+
5164
+ # Override the distribution configuration to enable multi-tenancy.
5165
+ cfn_distribution.distribution_config = distribution_config
5166
+
5167
+ # Create a connection group and a cname record in an existing hosted zone to validate domain ownership
5168
+ connection_group = cloudfront.CfnConnectionGroup(self, "cf-hosted-connection-group",
5169
+ enabled=True,
5170
+ ipv6_enabled=True,
5171
+ name="my-connection-group"
5172
+ )
5173
+
5174
+ # Import the existing hosted zone info, replacing with your hostedZoneId and zoneName
5175
+ hosted_zone_id = "YOUR_HOSTED_ZONE_ID"
5176
+ zone_name = "my.domain.com"
5177
+ hosted_zone = route53.HostedZone.from_hosted_zone_attributes(self, "hosted-zone",
5178
+ hosted_zone_id=hosted_zone_id,
5179
+ zone_name=zone_name
5180
+ )
5181
+
5182
+ record = route53.CnameRecord(self, "cname-record",
5183
+ domain_name=connection_group.attr_routing_endpoint,
5184
+ zone=hosted_zone,
5185
+ record_name="cf-hosted-tenant.my.domain.com"
5186
+ )
5187
+
5188
+ # Create the cloudfront-hosted tenant, passing in the previously created connection group
5189
+ cloudfront_hosted_tenant = cloudfront.CfnDistributionTenant(self, "cf-hosted-tenant",
5190
+ distribution_id=my_multi_tenant_distribution.distribution_id,
5191
+ name="cf-hosted-tenant",
5192
+ domains=["cf-hosted-tenant.my.domain.com"],
5193
+ connection_group_id=connection_group.attr_id,
5194
+ enabled=True,
5195
+ managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
5196
+ validation_token_host="cloudfront"
5197
+ )
4682
5198
  )
4683
5199
  '''
4684
5200
  if __debug__:
@@ -5697,23 +6213,85 @@ class CfnDistribution(
5697
6213
 
5698
6214
  Example::
5699
6215
 
5700
- # source_bucket: s3.Bucket
5701
-
6216
+ # Create the simple Origin
6217
+ my_bucket = s3.Bucket(self, "myBucket")
6218
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
6219
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
6220
+ )
5702
6221
 
5703
- my_distribution = cloudfront.Distribution(self, "MyCfWebDistribution",
6222
+ # Create the Distribution construct
6223
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "distribution",
5704
6224
  default_behavior=cloudfront.BehaviorOptions(
5705
- origin=origins.S3Origin(source_bucket)
5706
- )
6225
+ origin=s3_origin
6226
+ ),
6227
+ default_root_object="index.html"
5707
6228
  )
5708
- cfn_distribution = my_distribution.node.default_child
5709
- cfn_distribution.override_logical_id("MyDistributionCFDistribution3H55TI9Q")
5710
- '''
5711
-
5712
- def __init__(
5713
- self,
5714
- scope: _constructs_77d1e7e8.Construct,
5715
- id: builtins.str,
5716
- *,
6229
+
6230
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
6231
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
6232
+
6233
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
6234
+ target_origin_id=my_bucket.bucket_arn,
6235
+ viewer_protocol_policy="allow-all",
6236
+ compress=False,
6237
+ allowed_methods=["GET", "HEAD"],
6238
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
6239
+ )
6240
+ # Create the updated distributionConfig
6241
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
6242
+ default_cache_behavior=default_cache_behavior,
6243
+ enabled=True,
6244
+ # the properties below are optional
6245
+ connection_mode="tenant-only",
6246
+ origins=[cloudfront.CfnDistribution.OriginProperty(
6247
+ id=my_bucket.bucket_arn,
6248
+ domain_name=my_bucket.bucket_domain_name,
6249
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
6250
+ origin_path="/{{tenantName}}"
6251
+ )
6252
+ ],
6253
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
6254
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
6255
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
6256
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
6257
+ required=False,
6258
+ # the properties below are optional
6259
+ comment="tenantName",
6260
+ default_value="root"
6261
+ )
6262
+ ),
6263
+ name="tenantName"
6264
+ )
6265
+ ]
6266
+ )
6267
+ )
6268
+
6269
+ # Override the distribution configuration to enable multi-tenancy.
6270
+ cfn_distribution.distribution_config = distribution_config
6271
+
6272
+ # Create a distribution tenant using an existing ACM certificate
6273
+ cfn_distribution_tenant = cloudfront.CfnDistributionTenant(self, "distribution-tenant",
6274
+ distribution_id=my_multi_tenant_distribution.distribution_id,
6275
+ domains=["my-tenant.my.domain.com"],
6276
+ name="my-tenant",
6277
+ enabled=True,
6278
+ parameters=[cloudfront.CfnDistributionTenant.ParameterProperty(
6279
+ name="tenantName",
6280
+ value="app"
6281
+ )],
6282
+ customizations=cloudfront.CfnDistributionTenant.CustomizationsProperty(
6283
+ certificate=cloudfront.CfnDistributionTenant.CertificateProperty(
6284
+ arn="REPLACE_WITH_ARN"
6285
+ )
6286
+ )
6287
+ )
6288
+ '''
6289
+
6290
+ def __init__(
6291
+ self,
6292
+ scope: _constructs_77d1e7e8.Construct,
6293
+ id: builtins.str,
6294
+ *,
5717
6295
  distribution_config: typing.Union[_IResolvable_da3f097b, typing.Union["CfnDistribution.DistributionConfigProperty", typing.Dict[builtins.str, typing.Any]]],
5718
6296
  tags: typing.Optional[typing.Sequence[typing.Union[_CfnTag_f6864754, typing.Dict[builtins.str, typing.Any]]]] = None,
5719
6297
  ) -> None:
@@ -5899,20 +6477,20 @@ class CfnDistribution(
5899
6477
  :param cached_methods: A complex type that controls whether CloudFront caches the response to requests using the specified HTTP methods. There are two choices: - CloudFront caches responses to ``GET`` and ``HEAD`` requests. - CloudFront caches responses to ``GET`` , ``HEAD`` , and ``OPTIONS`` requests. If you pick the second choice for your Amazon S3 Origin, you may need to forward Access-Control-Request-Method, Access-Control-Request-Headers, and Origin headers for the responses to be cached correctly.
5900
6478
  :param cache_policy_id: The unique identifier of the cache policy that is attached to this cache behavior. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . A ``CacheBehavior`` must include either a ``CachePolicyId`` or ``ForwardedValues`` . We recommend that you use a ``CachePolicyId`` .
5901
6479
  :param compress: Whether you want CloudFront to automatically compress certain files for this cache behavior. If so, specify true; if not, specify false. For more information, see `Serving Compressed Files <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - false
5902
- :param default_ttl: This field is deprecated. We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 86400
6480
+ :param default_ttl: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . This field is deprecated. We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 86400
5903
6481
  :param field_level_encryption_id: The value of ``ID`` for the field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data for this cache behavior. Default: - ""
5904
6482
  :param forwarded_values: This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. For more information, see `Working with policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/working-with-policies.html>`_ in the *Amazon CloudFront Developer Guide* . If you want to include values in the cache key, use a cache policy. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see `Creating origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy>`_ or `Using the managed origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html>`_ in the *Amazon CloudFront Developer Guide* . A ``CacheBehavior`` must include either a ``CachePolicyId`` or ``ForwardedValues`` . We recommend that you use a ``CachePolicyId`` . A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.
5905
6483
  :param function_associations: A list of CloudFront functions that are associated with this cache behavior. CloudFront functions must be published to the ``LIVE`` stage to associate them with a cache behavior.
5906
6484
  :param grpc_config: The gRPC configuration for your cache behavior.
5907
6485
  :param lambda_function_associations: A complex type that contains zero or more Lambda@Edge function associations for a cache behavior.
5908
- :param max_ttl: This field is deprecated. We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 31536000
5909
- :param min_ttl: This field is deprecated. We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . You must specify ``0`` for ``MinTTL`` if you configure CloudFront to forward all headers to your origin (under ``Headers`` , if you specify ``1`` for ``Quantity`` and ``*`` for ``Name`` ). Default: - 0
6486
+ :param max_ttl: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . This field is deprecated. We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 31536000
6487
+ :param min_ttl: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . This field is deprecated. We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . You must specify ``0`` for ``MinTTL`` if you configure CloudFront to forward all headers to your origin (under ``Headers`` , if you specify ``1`` for ``Quantity`` and ``*`` for ``Name`` ). Default: - 0
5910
6488
  :param origin_request_policy_id: The unique identifier of the origin request policy that is attached to this cache behavior. For more information, see `Creating origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy>`_ or `Using the managed origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
5911
6489
  :param realtime_log_config_arn: The Amazon Resource Name (ARN) of the real-time log configuration that is attached to this cache behavior. For more information, see `Real-time logs <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html>`_ in the *Amazon CloudFront Developer Guide* .
5912
6490
  :param response_headers_policy_id: The identifier for a response headers policy.
5913
- :param smooth_streaming: Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` . Default: - false
6491
+ :param smooth_streaming: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` . Default: - false
5914
6492
  :param trusted_key_groups: A list of key groups that CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
5915
- :param trusted_signers: .. epigraph:: We recommend using ``TrustedKeyGroups`` instead of ``TrustedSigners`` . A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in the trusted signer's AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
6493
+ :param trusted_signers: .. epigraph:: We recommend using ``TrustedKeyGroups`` instead of ``TrustedSigners`` . .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in the trusted signer's AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
5916
6494
 
5917
6495
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html
5918
6496
  :exampleMetadata: fixture=_generated
@@ -6147,9 +6725,13 @@ class CfnDistribution(
6147
6725
 
6148
6726
  @builtins.property
6149
6727
  def default_ttl(self) -> typing.Optional[jsii.Number]:
6150
- '''This field is deprecated.
6728
+ '''.. epigraph::
6729
+
6730
+ This field only supports standard distributions.
6731
+
6732
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
6151
6733
 
6152
- We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
6734
+ This field is deprecated. We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
6153
6735
 
6154
6736
  The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
6155
6737
 
@@ -6229,9 +6811,13 @@ class CfnDistribution(
6229
6811
 
6230
6812
  @builtins.property
6231
6813
  def max_ttl(self) -> typing.Optional[jsii.Number]:
6232
- '''This field is deprecated.
6814
+ '''.. epigraph::
6815
+
6816
+ This field only supports standard distributions.
6233
6817
 
6234
- We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
6818
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
6819
+
6820
+ This field is deprecated. We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
6235
6821
 
6236
6822
  The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
6237
6823
 
@@ -6244,9 +6830,13 @@ class CfnDistribution(
6244
6830
 
6245
6831
  @builtins.property
6246
6832
  def min_ttl(self) -> typing.Optional[jsii.Number]:
6247
- '''This field is deprecated.
6833
+ '''.. epigraph::
6834
+
6835
+ This field only supports standard distributions.
6836
+
6837
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
6248
6838
 
6249
- We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
6839
+ This field is deprecated. We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
6250
6840
 
6251
6841
  The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
6252
6842
 
@@ -6294,9 +6884,13 @@ class CfnDistribution(
6294
6884
  def smooth_streaming(
6295
6885
  self,
6296
6886
  ) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
6297
- '''Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior.
6887
+ '''.. epigraph::
6888
+
6889
+ This field only supports standard distributions.
6890
+
6891
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
6298
6892
 
6299
- If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` .
6893
+ Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` .
6300
6894
 
6301
6895
  :default: - false
6302
6896
 
@@ -6322,6 +6916,10 @@ class CfnDistribution(
6322
6916
 
6323
6917
  We recommend using ``TrustedKeyGroups`` instead of ``TrustedSigners`` .
6324
6918
 
6919
+ .. epigraph::
6920
+
6921
+ This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
6922
+
6325
6923
  A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies.
6326
6924
 
6327
6925
  When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in the trusted signer's AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
@@ -6609,8 +7207,8 @@ class CfnDistribution(
6609
7207
  :param origin_protocol_policy: Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values are:. - ``http-only`` – CloudFront always uses HTTP to connect to the origin. - ``match-viewer`` – CloudFront connects to the origin using the same protocol that the viewer used to connect to CloudFront. - ``https-only`` – CloudFront always uses HTTPS to connect to the origin.
6610
7208
  :param http_port: The HTTP port that CloudFront uses to connect to the origin. Specify the HTTP port that the origin listens on. Default: - 80
6611
7209
  :param https_port: The HTTPS port that CloudFront uses to connect to the origin. Specify the HTTPS port that the origin listens on. Default: - 443
6612
- :param origin_keepalive_timeout: Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 5 seconds. For more information, see `Keep-alive timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginKeepaliveTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 5
6613
- :param origin_read_timeout: Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 30 seconds. For more information, see `Response timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginResponseTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 30
7210
+ :param origin_keepalive_timeout: Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 5 seconds. For more information, see `Keep-alive timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginKeepaliveTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 5
7211
+ :param origin_read_timeout: Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 30 seconds. For more information, see `Response timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginResponseTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 30
6614
7212
  :param origin_ssl_protocols: Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS. Valid values include ``SSLv3`` , ``TLSv1`` , ``TLSv1.1`` , and ``TLSv1.2`` . For more information, see `Minimum Origin SSL Protocol <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginSSLProtocols>`_ in the *Amazon CloudFront Developer Guide* .
6615
7213
 
6616
7214
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html
@@ -6699,7 +7297,7 @@ class CfnDistribution(
6699
7297
  def origin_keepalive_timeout(self) -> typing.Optional[jsii.Number]:
6700
7298
  '''Specifies how long, in seconds, CloudFront persists its connection to the origin.
6701
7299
 
6702
- The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 5 seconds.
7300
+ The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 5 seconds.
6703
7301
 
6704
7302
  For more information, see `Keep-alive timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginKeepaliveTimeout>`_ in the *Amazon CloudFront Developer Guide* .
6705
7303
 
@@ -6714,7 +7312,7 @@ class CfnDistribution(
6714
7312
  def origin_read_timeout(self) -> typing.Optional[jsii.Number]:
6715
7313
  '''Specifies how long, in seconds, CloudFront waits for a response from the origin.
6716
7314
 
6717
- This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 30 seconds.
7315
+ This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 30 seconds.
6718
7316
 
6719
7317
  For more information, see `Response timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginResponseTimeout>`_ in the *Amazon CloudFront Developer Guide* .
6720
7318
 
@@ -6810,74 +7408,106 @@ class CfnDistribution(
6810
7408
  :param cached_methods: A complex type that controls whether CloudFront caches the response to requests using the specified HTTP methods. There are two choices: - CloudFront caches responses to ``GET`` and ``HEAD`` requests. - CloudFront caches responses to ``GET`` , ``HEAD`` , and ``OPTIONS`` requests. If you pick the second choice for your Amazon S3 Origin, you may need to forward Access-Control-Request-Method, Access-Control-Request-Headers, and Origin headers for the responses to be cached correctly.
6811
7409
  :param cache_policy_id: The unique identifier of the cache policy that is attached to the default cache behavior. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . A ``DefaultCacheBehavior`` must include either a ``CachePolicyId`` or ``ForwardedValues`` . We recommend that you use a ``CachePolicyId`` . Default: - ""
6812
7410
  :param compress: Whether you want CloudFront to automatically compress certain files for this cache behavior. If so, specify ``true`` ; if not, specify ``false`` . For more information, see `Serving Compressed Files <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - false
6813
- :param default_ttl: This field is deprecated. We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 86400
7411
+ :param default_ttl: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . This field is deprecated. We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 86400
6814
7412
  :param field_level_encryption_id: The value of ``ID`` for the field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data for the default cache behavior. Default: - ""
6815
7413
  :param forwarded_values: This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. For more information, see `Working with policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/working-with-policies.html>`_ in the *Amazon CloudFront Developer Guide* . If you want to include values in the cache key, use a cache policy. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see `Creating origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy>`_ or `Using the managed origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html>`_ in the *Amazon CloudFront Developer Guide* . A ``DefaultCacheBehavior`` must include either a ``CachePolicyId`` or ``ForwardedValues`` . We recommend that you use a ``CachePolicyId`` . A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.
6816
7414
  :param function_associations: A list of CloudFront functions that are associated with this cache behavior. Your functions must be published to the ``LIVE`` stage to associate them with a cache behavior.
6817
7415
  :param grpc_config: The gRPC configuration for your cache behavior.
6818
7416
  :param lambda_function_associations: A complex type that contains zero or more Lambda@Edge function associations for a cache behavior.
6819
- :param max_ttl: This field is deprecated. We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 31536000
6820
- :param min_ttl: This field is deprecated. We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . You must specify ``0`` for ``MinTTL`` if you configure CloudFront to forward all headers to your origin (under ``Headers`` , if you specify ``1`` for ``Quantity`` and ``*`` for ``Name`` ). Default: - 0
7417
+ :param max_ttl: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . This field is deprecated. We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - 31536000
7418
+ :param min_ttl: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . This field is deprecated. We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* . The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* . You must specify ``0`` for ``MinTTL`` if you configure CloudFront to forward all headers to your origin (under ``Headers`` , if you specify ``1`` for ``Quantity`` and ``*`` for ``Name`` ). Default: - 0
6821
7419
  :param origin_request_policy_id: The unique identifier of the origin request policy that is attached to the default cache behavior. For more information, see `Creating origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html#origin-request-create-origin-request-policy>`_ or `Using the managed origin request policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - ""
6822
7420
  :param realtime_log_config_arn: The Amazon Resource Name (ARN) of the real-time log configuration that is attached to this cache behavior. For more information, see `Real-time logs <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - ""
6823
7421
  :param response_headers_policy_id: The identifier for a response headers policy. Default: - ""
6824
- :param smooth_streaming: Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` . Default: - false
7422
+ :param smooth_streaming: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` . Default: - false
6825
7423
  :param trusted_key_groups: A list of key groups that CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
6826
- :param trusted_signers: .. epigraph:: We recommend using ``TrustedKeyGroups`` instead of ``TrustedSigners`` . A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in a trusted signer's AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
7424
+ :param trusted_signers: .. epigraph:: We recommend using ``TrustedKeyGroups`` instead of ``TrustedSigners`` . .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in a trusted signer's AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
6827
7425
 
6828
7426
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html
6829
- :exampleMetadata: fixture=_generated
7427
+ :exampleMetadata: infused
6830
7428
 
6831
7429
  Example::
6832
7430
 
6833
- # The code below shows an example of how to instantiate this type.
6834
- # The values are placeholders you should change.
6835
- from aws_cdk import aws_cloudfront as cloudfront
7431
+ # Create the simple Origin
7432
+ my_bucket = s3.Bucket(self, "myBucket")
7433
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
7434
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
7435
+ )
6836
7436
 
6837
- default_cache_behavior_property = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
6838
- target_origin_id="targetOriginId",
6839
- viewer_protocol_policy="viewerProtocolPolicy",
7437
+ # Create the Distribution construct
7438
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
7439
+ default_behavior=cloudfront.BehaviorOptions(
7440
+ origin=s3_origin
7441
+ ),
7442
+ default_root_object="index.html"
7443
+ )
6840
7444
 
6841
- # the properties below are optional
6842
- allowed_methods=["allowedMethods"],
6843
- cached_methods=["cachedMethods"],
6844
- cache_policy_id="cachePolicyId",
7445
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
7446
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
7447
+
7448
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
7449
+ target_origin_id=my_bucket.bucket_arn,
7450
+ viewer_protocol_policy="allow-all",
6845
7451
  compress=False,
6846
- default_ttl=123,
6847
- field_level_encryption_id="fieldLevelEncryptionId",
6848
- forwarded_values=cloudfront.CfnDistribution.ForwardedValuesProperty(
6849
- query_string=False,
7452
+ allowed_methods=["GET", "HEAD"],
7453
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
7454
+ )
7455
+ # Create the updated distributionConfig
7456
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
7457
+ default_cache_behavior=default_cache_behavior,
7458
+ enabled=True,
7459
+ # the properties below are optional
7460
+ connection_mode="tenant-only",
7461
+ origins=[cloudfront.CfnDistribution.OriginProperty(
7462
+ id=my_bucket.bucket_arn,
7463
+ domain_name=my_bucket.bucket_domain_name,
7464
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
7465
+ origin_path="/{{tenantName}}"
7466
+ )
7467
+ ],
7468
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
7469
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
7470
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
7471
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
7472
+ required=False,
7473
+ # the properties below are optional
7474
+ comment="tenantName",
7475
+ default_value="root"
7476
+ )
7477
+ ),
7478
+ name="tenantName"
7479
+ )
7480
+ ]
7481
+ )
7482
+ )
6850
7483
 
6851
- # the properties below are optional
6852
- cookies=cloudfront.CfnDistribution.CookiesProperty(
6853
- forward="forward",
7484
+ # Override the distribution configuration to enable multi-tenancy.
7485
+ cfn_distribution.distribution_config = distribution_config
6854
7486
 
6855
- # the properties below are optional
6856
- whitelisted_names=["whitelistedNames"]
6857
- ),
6858
- headers=["headers"],
6859
- query_string_cache_keys=["queryStringCacheKeys"]
6860
- ),
6861
- function_associations=[cloudfront.CfnDistribution.FunctionAssociationProperty(
6862
- event_type="eventType",
6863
- function_arn="functionArn"
6864
- )],
6865
- grpc_config=cloudfront.CfnDistribution.GrpcConfigProperty(
6866
- enabled=False
6867
- ),
6868
- lambda_function_associations=[cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
6869
- event_type="eventType",
6870
- include_body=False,
6871
- lambda_function_arn="lambdaFunctionArn"
6872
- )],
6873
- max_ttl=123,
6874
- min_ttl=123,
6875
- origin_request_policy_id="originRequestPolicyId",
6876
- realtime_log_config_arn="realtimeLogConfigArn",
6877
- response_headers_policy_id="responseHeadersPolicyId",
6878
- smooth_streaming=False,
6879
- trusted_key_groups=["trustedKeyGroups"],
6880
- trusted_signers=["trustedSigners"]
7487
+ # Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
7488
+ connection_group = cloudfront.CfnConnectionGroup(self, "self-hosted-connection-group",
7489
+ enabled=True,
7490
+ ipv6_enabled=True,
7491
+ name="self-hosted-connection-group"
7492
+ )
7493
+
7494
+ # Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
7495
+ CfnOutput(self, "RoutingEndpoint",
7496
+ value=connection_group.attr_routing_endpoint,
7497
+ description="CloudFront Routing Endpoint to be added to my hosted zone CNAME records"
7498
+ )
7499
+
7500
+ # Create a distribution tenant with a self-hosted domain.
7501
+ self_hosted_tenant = cloudfront.CfnDistributionTenant(self, "self-hosted-tenant",
7502
+ distribution_id=my_multi_tenant_distribution.distribution_id,
7503
+ connection_group_id=connection_group.attr_id,
7504
+ name="self-hosted-tenant",
7505
+ domains=["self-hosted-tenant.my.domain.com"],
7506
+ enabled=True,
7507
+ managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
7508
+ primary_domain_name="self-hosted-tenant.my.domain.com",
7509
+ validation_token_host="self-hosted"
7510
+ )
6881
7511
  )
6882
7512
  '''
6883
7513
  if __debug__:
@@ -7039,9 +7669,13 @@ class CfnDistribution(
7039
7669
 
7040
7670
  @builtins.property
7041
7671
  def default_ttl(self) -> typing.Optional[jsii.Number]:
7042
- '''This field is deprecated.
7672
+ '''.. epigraph::
7673
+
7674
+ This field only supports standard distributions.
7043
7675
 
7044
- We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
7676
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
7677
+
7678
+ This field is deprecated. We recommend that you use the ``DefaultTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
7045
7679
 
7046
7680
  The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
7047
7681
 
@@ -7121,9 +7755,13 @@ class CfnDistribution(
7121
7755
 
7122
7756
  @builtins.property
7123
7757
  def max_ttl(self) -> typing.Optional[jsii.Number]:
7124
- '''This field is deprecated.
7758
+ '''.. epigraph::
7759
+
7760
+ This field only supports standard distributions.
7761
+
7762
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
7125
7763
 
7126
- We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
7764
+ This field is deprecated. We recommend that you use the ``MaxTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
7127
7765
 
7128
7766
  The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as ``Cache-Control max-age`` , ``Cache-Control s-maxage`` , and ``Expires`` to objects. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
7129
7767
 
@@ -7136,9 +7774,13 @@ class CfnDistribution(
7136
7774
 
7137
7775
  @builtins.property
7138
7776
  def min_ttl(self) -> typing.Optional[jsii.Number]:
7139
- '''This field is deprecated.
7777
+ '''.. epigraph::
7778
+
7779
+ This field only supports standard distributions.
7140
7780
 
7141
- We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
7781
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
7782
+
7783
+ This field is deprecated. We recommend that you use the ``MinTTL`` field in a cache policy instead of this field. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ or `Using the managed cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html>`_ in the *Amazon CloudFront Developer Guide* .
7142
7784
 
7143
7785
  The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see `Managing How Long Content Stays in an Edge Cache (Expiration) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
7144
7786
 
@@ -7192,9 +7834,13 @@ class CfnDistribution(
7192
7834
  def smooth_streaming(
7193
7835
  self,
7194
7836
  ) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
7195
- '''Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior.
7837
+ '''.. epigraph::
7196
7838
 
7197
- If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` .
7839
+ This field only supports standard distributions.
7840
+
7841
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
7842
+
7843
+ Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify ``true`` ; if not, specify ``false`` . If you specify ``true`` for ``SmoothStreaming`` , you can still distribute other content using this cache behavior if the content matches the value of ``PathPattern`` .
7198
7844
 
7199
7845
  :default: - false
7200
7846
 
@@ -7220,6 +7866,10 @@ class CfnDistribution(
7220
7866
 
7221
7867
  We recommend using ``TrustedKeyGroups`` instead of ``TrustedSigners`` .
7222
7868
 
7869
+ .. epigraph::
7870
+
7871
+ This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
7872
+
7223
7873
  A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies.
7224
7874
 
7225
7875
  When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in a trusted signer's AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see `Serving private content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>`_ in the *Amazon CloudFront Developer Guide* .
@@ -7365,265 +8015,114 @@ class CfnDistribution(
7365
8015
 
7366
8016
  :param default_cache_behavior: A complex type that describes the default cache behavior if you don't specify a ``CacheBehavior`` element or if files don't match any of the values of ``PathPattern`` in ``CacheBehavior`` elements. You must create exactly one default cache behavior.
7367
8017
  :param enabled: From this field, you can enable or disable the selected distribution.
7368
- :param aliases: A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.
7369
- :param anycast_ip_list_id: ID of the Anycast static IP list that is associated with the distribution.
8018
+ :param aliases: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.
8019
+ :param anycast_ip_list_id: .. epigraph:: To use this field for a multi-tenant distribution, use a connection group instead. For more information, see `ConnectionGroup <https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_ConnectionGroup.html>`_ . ID of the Anycast static IP list that is associated with the distribution.
7370
8020
  :param cache_behaviors: A complex type that contains zero or more ``CacheBehavior`` elements.
7371
8021
  :param cnam_es: An alias for the CloudFront distribution's domain name. .. epigraph:: This property is legacy. We recommend that you use `Aliases <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-aliases>`_ instead.
7372
8022
  :param comment: A comment to describe the distribution. The comment cannot be longer than 128 characters. Default: - ""
7373
- :param connection_mode: The connection mode to filter distributions by.
7374
- :param continuous_deployment_policy_id: The identifier of a continuous deployment policy. For more information, see ``CreateContinuousDeploymentPolicy`` .
8023
+ :param connection_mode: This field specifies whether the connection mode is through a standard distribution (direct) or a multi-tenant distribution with distribution tenants(tenant-only).
8024
+ :param continuous_deployment_policy_id: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . The identifier of a continuous deployment policy. For more information, see ``CreateContinuousDeploymentPolicy`` .
7375
8025
  :param custom_error_responses: A complex type that controls the following:. - Whether CloudFront replaces HTTP status codes in the 4xx and 5xx range with custom error messages before returning the response to the viewer. - How long CloudFront caches HTTP status codes in the 4xx and 5xx range. For more information about custom error pages, see `Customizing Error Responses <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html>`_ in the *Amazon CloudFront Developer Guide* .
7376
8026
  :param custom_origin: The user-defined HTTP server that serves as the origin for content that CloudFront distributes. .. epigraph:: This property is legacy. We recommend that you use `Origin <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html>`_ instead.
7377
- :param default_root_object: When a viewer requests the root URL for your distribution, the default root object is the object that you want CloudFront to request from your origin. For example, if your root URL is ``https://www.example.com`` , you can specify CloudFront to return the ``index.html`` file as the default root object. You can specify a default root object so that viewers see a specific file or object, instead of another object in your distribution (for example, ``https://www.example.com/product-description.html`` ). A default root object avoids exposing the contents of your distribution. You can specify the object name or a path to the object name (for example, ``index.html`` or ``exampleFolderName/index.html`` ). Your string can't begin with a forward slash ( ``/`` ). Only specify the object name or the path to the object. If you don't want to specify a default root object when you create a distribution, include an empty ``DefaultRootObject`` element. To delete the default root object from an existing distribution, update the distribution configuration and include an empty ``DefaultRootObject`` element. To replace the default root object, update the distribution configuration and specify the new object. For more information about the default root object, see `Specify a default root object <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DefaultRootObject.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - ""
7378
- :param http_version: (Optional) Specify the HTTP version(s) that you want viewers to use to communicate with CloudFront . The default value for new distributions is ``http1.1`` . For viewers and CloudFront to use HTTP/2, viewers must support TLSv1.2 or later, and must support Server Name Indication (SNI). For viewers and CloudFront to use HTTP/3, viewers must support TLSv1.3 and Server Name Indication (SNI). CloudFront supports HTTP/3 connection migration to allow the viewer to switch networks without losing connection. For more information about connection migration, see `Connection Migration <https://docs.aws.amazon.com/https://www.rfc-editor.org/rfc/rfc9000.html#name-connection-migration>`_ at RFC 9000. For more information about supported TLSv1.3 ciphers, see `Supported protocols and ciphers between viewers and CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html>`_ . Default: - "http1.1"
7379
- :param ipv6_enabled: If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify ``true`` . If you specify ``false`` , CloudFront responds to IPv6 DNS requests with the DNS response code ``NOERROR`` and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution. In general, you should enable IPv6 if you have users on IPv6 networks who want to access your content. However, if you're using signed URLs or signed cookies to restrict access to your content, and if you're using a custom policy that includes the ``IpAddress`` parameter to restrict the IP addresses that can access your content, don't enable IPv6. If you want to restrict access to some content by IP address and not restrict access to other content (or restrict access but not by IP address), you can create two distributions. For more information, see `Creating a Signed URL Using a Custom Policy <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html>`_ in the *Amazon CloudFront Developer Guide* . If you're using an Amazon Route 53 AWS Integration alias resource record set to route traffic to your CloudFront distribution, you need to create a second alias resource record set when both of the following are true: - You enable IPv6 for the distribution - You're using alternate domain names in the URLs for your objects For more information, see `Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html>`_ in the *Amazon Route 53 AWS Integration Developer Guide* . If you created a CNAME resource record set, either with Amazon Route 53 AWS Integration or with another DNS service, you don't need to make any changes. A CNAME record will route traffic to your distribution regardless of the IP address format of the viewer request.
7380
- :param logging: A complex type that controls whether access logs are written for the distribution. For more information about logging, see `Access Logs <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html>`_ in the *Amazon CloudFront Developer Guide* .
7381
- :param origin_groups: A complex type that contains information about origin groups for this distribution. Specify a value for either the ``Origins`` or ``OriginGroups`` property.
7382
- :param origins: A complex type that contains information about origins for this distribution. Specify a value for either the ``Origins`` or ``OriginGroups`` property.
7383
- :param price_class: The price class that corresponds with the maximum price that you want to pay for CloudFront service. If you specify ``PriceClass_All`` , CloudFront responds to requests for your objects from all CloudFront edge locations. If you specify a price class other than ``PriceClass_All`` , CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class. Viewers who are in or near regions that are excluded from your specified price class may encounter slower performance. For more information about price classes, see `Choosing the Price Class for a CloudFront Distribution <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html>`_ in the *Amazon CloudFront Developer Guide* . For information about CloudFront pricing, including how price classes (such as Price Class 100) map to CloudFront regions, see `Amazon CloudFront Pricing <https://docs.aws.amazon.com/cloudfront/pricing/>`_ . Default: - "PriceClass_All"
7384
- :param restrictions: A complex type that identifies ways in which you want to restrict distribution of your content.
7385
- :param s3_origin: The origin as an Amazon S3 bucket. .. epigraph:: This property is legacy. We recommend that you use `Origin <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html>`_ instead.
7386
- :param staging: A Boolean that indicates whether this is a staging distribution. When this value is ``true`` , this is a staging distribution. When this value is ``false`` , this is not a staging distribution.
7387
- :param tenant_config: A distribution tenant configuration.
7388
- :param viewer_certificate: A complex type that determines the distribution's SSL/TLS configuration for communicating with viewers.
7389
- :param web_acl_id: A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution. To specify a web ACL created using the latest version of AWS WAF , use the ACL ARN, for example ``arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` . To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example ``a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` . AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS requests that are forwarded to CloudFront, and lets you control access to your content. Based on conditions that you specify, such as the IP addresses that requests originate from or the values of query strings, CloudFront responds to requests either with the requested content or with an HTTP 403 status code (Forbidden). You can also configure CloudFront to return a custom error page when a request is blocked. For more information about AWS WAF , see the `AWS WAF Developer Guide <https://docs.aws.amazon.com/waf/latest/developerguide/what-is-aws-waf.html>`_ . Default: - ""
7390
-
7391
- :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html
7392
- :exampleMetadata: fixture=_generated
7393
-
7394
- Example::
7395
-
7396
- # The code below shows an example of how to instantiate this type.
7397
- # The values are placeholders you should change.
7398
- from aws_cdk import aws_cloudfront as cloudfront
7399
-
7400
- distribution_config_property = cloudfront.CfnDistribution.DistributionConfigProperty(
7401
- default_cache_behavior=cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
7402
- target_origin_id="targetOriginId",
7403
- viewer_protocol_policy="viewerProtocolPolicy",
7404
-
7405
- # the properties below are optional
7406
- allowed_methods=["allowedMethods"],
7407
- cached_methods=["cachedMethods"],
7408
- cache_policy_id="cachePolicyId",
7409
- compress=False,
7410
- default_ttl=123,
7411
- field_level_encryption_id="fieldLevelEncryptionId",
7412
- forwarded_values=cloudfront.CfnDistribution.ForwardedValuesProperty(
7413
- query_string=False,
7414
-
7415
- # the properties below are optional
7416
- cookies=cloudfront.CfnDistribution.CookiesProperty(
7417
- forward="forward",
7418
-
7419
- # the properties below are optional
7420
- whitelisted_names=["whitelistedNames"]
7421
- ),
7422
- headers=["headers"],
7423
- query_string_cache_keys=["queryStringCacheKeys"]
7424
- ),
7425
- function_associations=[cloudfront.CfnDistribution.FunctionAssociationProperty(
7426
- event_type="eventType",
7427
- function_arn="functionArn"
7428
- )],
7429
- grpc_config=cloudfront.CfnDistribution.GrpcConfigProperty(
7430
- enabled=False
7431
- ),
7432
- lambda_function_associations=[cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
7433
- event_type="eventType",
7434
- include_body=False,
7435
- lambda_function_arn="lambdaFunctionArn"
7436
- )],
7437
- max_ttl=123,
7438
- min_ttl=123,
7439
- origin_request_policy_id="originRequestPolicyId",
7440
- realtime_log_config_arn="realtimeLogConfigArn",
7441
- response_headers_policy_id="responseHeadersPolicyId",
7442
- smooth_streaming=False,
7443
- trusted_key_groups=["trustedKeyGroups"],
7444
- trusted_signers=["trustedSigners"]
7445
- ),
7446
- enabled=False,
7447
-
7448
- # the properties below are optional
7449
- aliases=["aliases"],
7450
- anycast_ip_list_id="anycastIpListId",
7451
- cache_behaviors=[cloudfront.CfnDistribution.CacheBehaviorProperty(
7452
- path_pattern="pathPattern",
7453
- target_origin_id="targetOriginId",
7454
- viewer_protocol_policy="viewerProtocolPolicy",
7455
-
7456
- # the properties below are optional
7457
- allowed_methods=["allowedMethods"],
7458
- cached_methods=["cachedMethods"],
7459
- cache_policy_id="cachePolicyId",
7460
- compress=False,
7461
- default_ttl=123,
7462
- field_level_encryption_id="fieldLevelEncryptionId",
7463
- forwarded_values=cloudfront.CfnDistribution.ForwardedValuesProperty(
7464
- query_string=False,
7465
-
7466
- # the properties below are optional
7467
- cookies=cloudfront.CfnDistribution.CookiesProperty(
7468
- forward="forward",
7469
-
7470
- # the properties below are optional
7471
- whitelisted_names=["whitelistedNames"]
7472
- ),
7473
- headers=["headers"],
7474
- query_string_cache_keys=["queryStringCacheKeys"]
7475
- ),
7476
- function_associations=[cloudfront.CfnDistribution.FunctionAssociationProperty(
7477
- event_type="eventType",
7478
- function_arn="functionArn"
7479
- )],
7480
- grpc_config=cloudfront.CfnDistribution.GrpcConfigProperty(
7481
- enabled=False
7482
- ),
7483
- lambda_function_associations=[cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
7484
- event_type="eventType",
7485
- include_body=False,
7486
- lambda_function_arn="lambdaFunctionArn"
7487
- )],
7488
- max_ttl=123,
7489
- min_ttl=123,
7490
- origin_request_policy_id="originRequestPolicyId",
7491
- realtime_log_config_arn="realtimeLogConfigArn",
7492
- response_headers_policy_id="responseHeadersPolicyId",
7493
- smooth_streaming=False,
7494
- trusted_key_groups=["trustedKeyGroups"],
7495
- trusted_signers=["trustedSigners"]
7496
- )],
7497
- cnam_es=["cnamEs"],
7498
- comment="comment",
7499
- connection_mode="connectionMode",
7500
- continuous_deployment_policy_id="continuousDeploymentPolicyId",
7501
- custom_error_responses=[cloudfront.CfnDistribution.CustomErrorResponseProperty(
7502
- error_code=123,
7503
-
7504
- # the properties below are optional
7505
- error_caching_min_ttl=123,
7506
- response_code=123,
7507
- response_page_path="responsePagePath"
7508
- )],
7509
- custom_origin=cloudfront.CfnDistribution.LegacyCustomOriginProperty(
7510
- dns_name="dnsName",
7511
- origin_protocol_policy="originProtocolPolicy",
7512
- origin_ssl_protocols=["originSslProtocols"],
7513
-
7514
- # the properties below are optional
7515
- http_port=123,
7516
- https_port=123
7517
- ),
7518
- default_root_object="defaultRootObject",
7519
- http_version="httpVersion",
7520
- ipv6_enabled=False,
7521
- logging=cloudfront.CfnDistribution.LoggingProperty(
7522
- bucket="bucket",
7523
- include_cookies=False,
7524
- prefix="prefix"
7525
- ),
7526
- origin_groups=cloudfront.CfnDistribution.OriginGroupsProperty(
7527
- quantity=123,
7528
-
7529
- # the properties below are optional
7530
- items=[cloudfront.CfnDistribution.OriginGroupProperty(
7531
- failover_criteria=cloudfront.CfnDistribution.OriginGroupFailoverCriteriaProperty(
7532
- status_codes=cloudfront.CfnDistribution.StatusCodesProperty(
7533
- items=[123],
7534
- quantity=123
7535
- )
7536
- ),
7537
- id="id",
7538
- members=cloudfront.CfnDistribution.OriginGroupMembersProperty(
7539
- items=[cloudfront.CfnDistribution.OriginGroupMemberProperty(
7540
- origin_id="originId"
7541
- )],
7542
- quantity=123
7543
- ),
7544
-
7545
- # the properties below are optional
7546
- selection_criteria="selectionCriteria"
7547
- )]
7548
- ),
7549
- origins=[cloudfront.CfnDistribution.OriginProperty(
7550
- domain_name="domainName",
7551
- id="id",
7552
-
7553
- # the properties below are optional
7554
- connection_attempts=123,
7555
- connection_timeout=123,
7556
- custom_origin_config=cloudfront.CfnDistribution.CustomOriginConfigProperty(
7557
- origin_protocol_policy="originProtocolPolicy",
7558
-
7559
- # the properties below are optional
7560
- http_port=123,
7561
- https_port=123,
7562
- origin_keepalive_timeout=123,
7563
- origin_read_timeout=123,
7564
- origin_ssl_protocols=["originSslProtocols"]
7565
- ),
7566
- origin_access_control_id="originAccessControlId",
7567
- origin_custom_headers=[cloudfront.CfnDistribution.OriginCustomHeaderProperty(
7568
- header_name="headerName",
7569
- header_value="headerValue"
7570
- )],
7571
- origin_path="originPath",
7572
- origin_shield=cloudfront.CfnDistribution.OriginShieldProperty(
7573
- enabled=False,
7574
- origin_shield_region="originShieldRegion"
7575
- ),
7576
- response_completion_timeout=123,
7577
- s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(
7578
- origin_access_identity="originAccessIdentity",
7579
- origin_read_timeout=123
7580
- ),
7581
- vpc_origin_config=cloudfront.CfnDistribution.VpcOriginConfigProperty(
7582
- vpc_origin_id="vpcOriginId",
7583
-
7584
- # the properties below are optional
7585
- origin_keepalive_timeout=123,
7586
- origin_read_timeout=123
7587
- )
7588
- )],
7589
- price_class="priceClass",
7590
- restrictions=cloudfront.CfnDistribution.RestrictionsProperty(
7591
- geo_restriction=cloudfront.CfnDistribution.GeoRestrictionProperty(
7592
- restriction_type="restrictionType",
8027
+ :param default_root_object: When a viewer requests the root URL for your distribution, the default root object is the object that you want CloudFront to request from your origin. For example, if your root URL is ``https://www.example.com`` , you can specify CloudFront to return the ``index.html`` file as the default root object. You can specify a default root object so that viewers see a specific file or object, instead of another object in your distribution (for example, ``https://www.example.com/product-description.html`` ). A default root object avoids exposing the contents of your distribution. You can specify the object name or a path to the object name (for example, ``index.html`` or ``exampleFolderName/index.html`` ). Your string can't begin with a forward slash ( ``/`` ). Only specify the object name or the path to the object. If you don't want to specify a default root object when you create a distribution, include an empty ``DefaultRootObject`` element. To delete the default root object from an existing distribution, update the distribution configuration and include an empty ``DefaultRootObject`` element. To replace the default root object, update the distribution configuration and specify the new object. For more information about the default root object, see `Specify a default root object <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DefaultRootObject.html>`_ in the *Amazon CloudFront Developer Guide* . Default: - ""
8028
+ :param http_version: (Optional) Specify the HTTP version(s) that you want viewers to use to communicate with CloudFront . The default value for new distributions is ``http1.1`` . For viewers and CloudFront to use HTTP/2, viewers must support TLSv1.2 or later, and must support Server Name Indication (SNI). For viewers and CloudFront to use HTTP/3, viewers must support TLSv1.3 and Server Name Indication (SNI). CloudFront supports HTTP/3 connection migration to allow the viewer to switch networks without losing connection. For more information about connection migration, see `Connection Migration <https://docs.aws.amazon.com/https://www.rfc-editor.org/rfc/rfc9000.html#name-connection-migration>`_ at RFC 9000. For more information about supported TLSv1.3 ciphers, see `Supported protocols and ciphers between viewers and CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html>`_ . Default: - "http1.1"
8029
+ :param ipv6_enabled: .. epigraph:: To use this field for a multi-tenant distribution, use a connection group instead. For more information, see `ConnectionGroup <https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_ConnectionGroup.html>`_ . If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify ``true`` . If you specify ``false`` , CloudFront responds to IPv6 DNS requests with the DNS response code ``NOERROR`` and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution. In general, you should enable IPv6 if you have users on IPv6 networks who want to access your content. However, if you're using signed URLs or signed cookies to restrict access to your content, and if you're using a custom policy that includes the ``IpAddress`` parameter to restrict the IP addresses that can access your content, don't enable IPv6. If you want to restrict access to some content by IP address and not restrict access to other content (or restrict access but not by IP address), you can create two distributions. For more information, see `Creating a Signed URL Using a Custom Policy <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html>`_ in the *Amazon CloudFront Developer Guide* . If you're using an Amazon Route 53 AWS Integration alias resource record set to route traffic to your CloudFront distribution, you need to create a second alias resource record set when both of the following are true: - You enable IPv6 for the distribution - You're using alternate domain names in the URLs for your objects For more information, see `Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html>`_ in the *Amazon Route 53 AWS Integration Developer Guide* . If you created a CNAME resource record set, either with Amazon Route 53 AWS Integration or with another DNS service, you don't need to make any changes. A CNAME record will route traffic to your distribution regardless of the IP address format of the viewer request.
8030
+ :param logging: A complex type that controls whether access logs are written for the distribution. For more information about logging, see `Access Logs <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html>`_ in the *Amazon CloudFront Developer Guide* .
8031
+ :param origin_groups: A complex type that contains information about origin groups for this distribution. Specify a value for either the ``Origins`` or ``OriginGroups`` property.
8032
+ :param origins: A complex type that contains information about origins for this distribution. Specify a value for either the ``Origins`` or ``OriginGroups`` property.
8033
+ :param price_class: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . The price class that corresponds with the maximum price that you want to pay for CloudFront service. If you specify ``PriceClass_All`` , CloudFront responds to requests for your objects from all CloudFront edge locations. If you specify a price class other than ``PriceClass_All`` , CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class. Viewers who are in or near regions that are excluded from your specified price class may encounter slower performance. For more information about price classes, see `Choosing the Price Class for a CloudFront Distribution <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html>`_ in the *Amazon CloudFront Developer Guide* . For information about CloudFront pricing, including how price classes (such as Price Class 100) map to CloudFront regions, see `Amazon CloudFront Pricing <https://docs.aws.amazon.com/cloudfront/pricing/>`_ . Default: - "PriceClass_All"
8034
+ :param restrictions: A complex type that identifies ways in which you want to restrict distribution of your content.
8035
+ :param s3_origin: The origin as an Amazon S3 bucket. .. epigraph:: This property is legacy. We recommend that you use `Origin <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html>`_ instead.
8036
+ :param staging: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . A Boolean that indicates whether this is a staging distribution. When this value is ``true`` , this is a staging distribution. When this value is ``false`` , this is not a staging distribution.
8037
+ :param tenant_config: .. epigraph:: This field only supports multi-tenant distributions. You can't specify this field for standard distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . A distribution tenant configuration.
8038
+ :param viewer_certificate: A complex type that determines the distribution's SSL/TLS configuration for communicating with viewers.
8039
+ :param web_acl_id: .. epigraph:: Multi-tenant distributions only support AWS WAF V2 web ACLs. A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution. To specify a web ACL created using the latest version of AWS WAF , use the ACL ARN, for example ``arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` . To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example ``a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` . AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS requests that are forwarded to CloudFront, and lets you control access to your content. Based on conditions that you specify, such as the IP addresses that requests originate from or the values of query strings, CloudFront responds to requests either with the requested content or with an HTTP 403 status code (Forbidden). You can also configure CloudFront to return a custom error page when a request is blocked. For more information about AWS WAF , see the `AWS WAF Developer Guide <https://docs.aws.amazon.com/waf/latest/developerguide/what-is-aws-waf.html>`_ . Default: - ""
8040
+
8041
+ :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html
8042
+ :exampleMetadata: infused
8043
+
8044
+ Example::
8045
+
8046
+ # Create the simple Origin
8047
+ my_bucket = s3.Bucket(self, "myBucket")
8048
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
8049
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
8050
+ )
7593
8051
 
7594
- # the properties below are optional
7595
- locations=["locations"]
7596
- )
8052
+ # Create the Distribution construct
8053
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
8054
+ default_behavior=cloudfront.BehaviorOptions(
8055
+ origin=s3_origin
7597
8056
  ),
7598
- s3_origin=cloudfront.CfnDistribution.LegacyS3OriginProperty(
7599
- dns_name="dnsName",
8057
+ default_root_object="index.html"
8058
+ )
7600
8059
 
7601
- # the properties below are optional
7602
- origin_access_identity="originAccessIdentity"
7603
- ),
7604
- staging=False,
8060
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
8061
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
8062
+
8063
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
8064
+ target_origin_id=my_bucket.bucket_arn,
8065
+ viewer_protocol_policy="allow-all",
8066
+ compress=False,
8067
+ allowed_methods=["GET", "HEAD"],
8068
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
8069
+ )
8070
+ # Create the updated distributionConfig
8071
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
8072
+ default_cache_behavior=default_cache_behavior,
8073
+ enabled=True,
8074
+ # the properties below are optional
8075
+ connection_mode="tenant-only",
8076
+ origins=[cloudfront.CfnDistribution.OriginProperty(
8077
+ id=my_bucket.bucket_arn,
8078
+ domain_name=my_bucket.bucket_domain_name,
8079
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
8080
+ origin_path="/{{tenantName}}"
8081
+ )
8082
+ ],
7605
8083
  tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
7606
8084
  parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
7607
8085
  definition=cloudfront.CfnDistribution.DefinitionProperty(
7608
8086
  string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
7609
8087
  required=False,
7610
-
7611
8088
  # the properties below are optional
7612
- comment="comment",
7613
- default_value="defaultValue"
8089
+ comment="tenantName",
8090
+ default_value="root"
7614
8091
  )
7615
8092
  ),
7616
- name="name"
7617
- )]
7618
- ),
7619
- viewer_certificate=cloudfront.CfnDistribution.ViewerCertificateProperty(
7620
- acm_certificate_arn="acmCertificateArn",
7621
- cloud_front_default_certificate=False,
7622
- iam_certificate_id="iamCertificateId",
7623
- minimum_protocol_version="minimumProtocolVersion",
7624
- ssl_support_method="sslSupportMethod"
7625
- ),
7626
- web_acl_id="webAclId"
8093
+ name="tenantName"
8094
+ )
8095
+ ]
8096
+ )
8097
+ )
8098
+
8099
+ # Override the distribution configuration to enable multi-tenancy.
8100
+ cfn_distribution.distribution_config = distribution_config
8101
+
8102
+ # Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
8103
+ connection_group = cloudfront.CfnConnectionGroup(self, "self-hosted-connection-group",
8104
+ enabled=True,
8105
+ ipv6_enabled=True,
8106
+ name="self-hosted-connection-group"
8107
+ )
8108
+
8109
+ # Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
8110
+ CfnOutput(self, "RoutingEndpoint",
8111
+ value=connection_group.attr_routing_endpoint,
8112
+ description="CloudFront Routing Endpoint to be added to my hosted zone CNAME records"
8113
+ )
8114
+
8115
+ # Create a distribution tenant with a self-hosted domain.
8116
+ self_hosted_tenant = cloudfront.CfnDistributionTenant(self, "self-hosted-tenant",
8117
+ distribution_id=my_multi_tenant_distribution.distribution_id,
8118
+ connection_group_id=connection_group.attr_id,
8119
+ name="self-hosted-tenant",
8120
+ domains=["self-hosted-tenant.my.domain.com"],
8121
+ enabled=True,
8122
+ managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
8123
+ primary_domain_name="self-hosted-tenant.my.domain.com",
8124
+ validation_token_host="self-hosted"
8125
+ )
7627
8126
  )
7628
8127
  '''
7629
8128
  if __debug__:
@@ -7727,7 +8226,13 @@ class CfnDistribution(
7727
8226
 
7728
8227
  @builtins.property
7729
8228
  def aliases(self) -> typing.Optional[typing.List[builtins.str]]:
7730
- '''A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.
8229
+ '''.. epigraph::
8230
+
8231
+ This field only supports standard distributions.
8232
+
8233
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
8234
+
8235
+ A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.
7731
8236
 
7732
8237
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-aliases
7733
8238
  '''
@@ -7736,7 +8241,13 @@ class CfnDistribution(
7736
8241
 
7737
8242
  @builtins.property
7738
8243
  def anycast_ip_list_id(self) -> typing.Optional[builtins.str]:
7739
- '''ID of the Anycast static IP list that is associated with the distribution.
8244
+ '''.. epigraph::
8245
+
8246
+ To use this field for a multi-tenant distribution, use a connection group instead.
8247
+
8248
+ For more information, see `ConnectionGroup <https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_ConnectionGroup.html>`_ .
8249
+
8250
+ ID of the Anycast static IP list that is associated with the distribution.
7740
8251
 
7741
8252
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-anycastiplistid
7742
8253
  '''
@@ -7782,7 +8293,7 @@ class CfnDistribution(
7782
8293
 
7783
8294
  @builtins.property
7784
8295
  def connection_mode(self) -> typing.Optional[builtins.str]:
7785
- '''The connection mode to filter distributions by.
8296
+ '''This field specifies whether the connection mode is through a standard distribution (direct) or a multi-tenant distribution with distribution tenants(tenant-only).
7786
8297
 
7787
8298
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-connectionmode
7788
8299
  '''
@@ -7791,9 +8302,13 @@ class CfnDistribution(
7791
8302
 
7792
8303
  @builtins.property
7793
8304
  def continuous_deployment_policy_id(self) -> typing.Optional[builtins.str]:
7794
- '''The identifier of a continuous deployment policy.
8305
+ '''.. epigraph::
8306
+
8307
+ This field only supports standard distributions.
7795
8308
 
7796
- For more information, see ``CreateContinuousDeploymentPolicy`` .
8309
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
8310
+
8311
+ The identifier of a continuous deployment policy. For more information, see ``CreateContinuousDeploymentPolicy`` .
7797
8312
 
7798
8313
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-continuousdeploymentpolicyid
7799
8314
  '''
@@ -7875,9 +8390,13 @@ class CfnDistribution(
7875
8390
  def ipv6_enabled(
7876
8391
  self,
7877
8392
  ) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
7878
- '''If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify ``true`` .
8393
+ '''.. epigraph::
8394
+
8395
+ To use this field for a multi-tenant distribution, use a connection group instead.
8396
+
8397
+ For more information, see `ConnectionGroup <https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_ConnectionGroup.html>`_ .
7879
8398
 
7880
- If you specify ``false`` , CloudFront responds to IPv6 DNS requests with the DNS response code ``NOERROR`` and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution.
8399
+ If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify ``true`` . If you specify ``false`` , CloudFront responds to IPv6 DNS requests with the DNS response code ``NOERROR`` and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution.
7881
8400
 
7882
8401
  In general, you should enable IPv6 if you have users on IPv6 networks who want to access your content. However, if you're using signed URLs or signed cookies to restrict access to your content, and if you're using a custom policy that includes the ``IpAddress`` parameter to restrict the IP addresses that can access your content, don't enable IPv6. If you want to restrict access to some content by IP address and not restrict access to other content (or restrict access but not by IP address), you can create two distributions. For more information, see `Creating a Signed URL Using a Custom Policy <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html>`_ in the *Amazon CloudFront Developer Guide* .
7883
8402
 
@@ -7936,9 +8455,13 @@ class CfnDistribution(
7936
8455
 
7937
8456
  @builtins.property
7938
8457
  def price_class(self) -> typing.Optional[builtins.str]:
7939
- '''The price class that corresponds with the maximum price that you want to pay for CloudFront service.
8458
+ '''.. epigraph::
8459
+
8460
+ This field only supports standard distributions.
7940
8461
 
7941
- If you specify ``PriceClass_All`` , CloudFront responds to requests for your objects from all CloudFront edge locations.
8462
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
8463
+
8464
+ The price class that corresponds with the maximum price that you want to pay for CloudFront service. If you specify ``PriceClass_All`` , CloudFront responds to requests for your objects from all CloudFront edge locations.
7942
8465
 
7943
8466
  If you specify a price class other than ``PriceClass_All`` , CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class. Viewers who are in or near regions that are excluded from your specified price class may encounter slower performance.
7944
8467
 
@@ -7981,9 +8504,13 @@ class CfnDistribution(
7981
8504
  def staging(
7982
8505
  self,
7983
8506
  ) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
7984
- '''A Boolean that indicates whether this is a staging distribution.
8507
+ '''.. epigraph::
7985
8508
 
7986
- When this value is ``true`` , this is a staging distribution. When this value is ``false`` , this is not a staging distribution.
8509
+ This field only supports standard distributions.
8510
+
8511
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
8512
+
8513
+ A Boolean that indicates whether this is a staging distribution. When this value is ``true`` , this is a staging distribution. When this value is ``false`` , this is not a staging distribution.
7987
8514
 
7988
8515
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-staging
7989
8516
  '''
@@ -7994,7 +8521,13 @@ class CfnDistribution(
7994
8521
  def tenant_config(
7995
8522
  self,
7996
8523
  ) -> typing.Optional[typing.Union[_IResolvable_da3f097b, "CfnDistribution.TenantConfigProperty"]]:
7997
- '''A distribution tenant configuration.
8524
+ '''.. epigraph::
8525
+
8526
+ This field only supports multi-tenant distributions.
8527
+
8528
+ You can't specify this field for standard distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
8529
+
8530
+ A distribution tenant configuration.
7998
8531
 
7999
8532
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-tenantconfig
8000
8533
  '''
@@ -8014,9 +8547,11 @@ class CfnDistribution(
8014
8547
 
8015
8548
  @builtins.property
8016
8549
  def web_acl_id(self) -> typing.Optional[builtins.str]:
8017
- '''A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution.
8550
+ '''.. epigraph::
8551
+
8552
+ Multi-tenant distributions only support AWS WAF V2 web ACLs.
8018
8553
 
8019
- To specify a web ACL created using the latest version of AWS WAF , use the ACL ARN, for example ``arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` . To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example ``a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` .
8554
+ A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution. To specify a web ACL created using the latest version of AWS WAF , use the ACL ARN, for example ``arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` . To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example ``a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`` .
8020
8555
 
8021
8556
  AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS requests that are forwarded to CloudFront, and lets you control access to your content. Based on conditions that you specify, such as the IP addresses that requests originate from or the values of query strings, CloudFront responds to requests either with the requested content or with an HTTP 403 status code (Forbidden). You can also configure CloudFront to return a custom error page when a request is blocked. For more information about AWS WAF , see the `AWS WAF Developer Guide <https://docs.aws.amazon.com/waf/latest/developerguide/what-is-aws-waf.html>`_ .
8022
8557
 
@@ -8057,9 +8592,13 @@ class CfnDistribution(
8057
8592
  headers: typing.Optional[typing.Sequence[builtins.str]] = None,
8058
8593
  query_string_cache_keys: typing.Optional[typing.Sequence[builtins.str]] = None,
8059
8594
  ) -> None:
8060
- '''This field is deprecated.
8595
+ '''.. epigraph::
8061
8596
 
8062
- We recommend that you use a cache policy or an origin request policy instead of this field.
8597
+ This field only supports standard distributions.
8598
+
8599
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
8600
+
8601
+ This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field.
8063
8602
 
8064
8603
  If you want to include values in the cache key, use a cache policy. For more information, see `Creating cache policies <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html#cache-key-create-cache-policy>`_ in the *Amazon CloudFront Developer Guide* .
8065
8604
 
@@ -10141,7 +10680,13 @@ class CfnDistribution(
10141
10680
  *,
10142
10681
  parameter_definitions: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Sequence[typing.Union[_IResolvable_da3f097b, typing.Union["CfnDistribution.ParameterDefinitionProperty", typing.Dict[builtins.str, typing.Any]]]]]] = None,
10143
10682
  ) -> None:
10144
- '''The configuration for a distribution tenant.
10683
+ '''.. epigraph::
10684
+
10685
+ This field only supports multi-tenant distributions.
10686
+
10687
+ You can't specify this field for standard distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* .
10688
+
10689
+ The configuration for a distribution tenant.
10145
10690
 
10146
10691
  :param parameter_definitions: The parameters that you specify for a distribution tenant.
10147
10692
 
@@ -10239,7 +10784,7 @@ class CfnDistribution(
10239
10784
 
10240
10785
  :param acm_certificate_arn: .. epigraph:: In CloudFormation, this field name is ``AcmCertificateArn`` . Note the different capitalization. If the distribution uses ``Aliases`` (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in `AWS Certificate Manager (ACM) <https://docs.aws.amazon.com/acm/latest/userguide/acm-overview.html>`_ , provide the Amazon Resource Name (ARN) of the ACM certificate. CloudFront only supports ACM certificates in the US East (N. Virginia) Region ( ``us-east-1`` ). If you specify an ACM certificate ARN, you must also specify values for ``MinimumProtocolVersion`` and ``SSLSupportMethod`` . (In CloudFormation, the field name is ``SslSupportMethod`` . Note the different capitalization.)
10241
10786
  :param cloud_front_default_certificate: If the distribution uses the CloudFront domain name such as ``d111111abcdef8.cloudfront.net`` , set this field to ``true`` . If the distribution uses ``Aliases`` (alternate domain names or CNAMEs), omit this field and specify values for the following fields: - ``AcmCertificateArn`` or ``IamCertificateId`` (specify a value for one, not both) - ``MinimumProtocolVersion`` - ``SslSupportMethod``
10242
- :param iam_certificate_id: .. epigraph:: In CloudFormation, this field name is ``IamCertificateId`` . Note the different capitalization. If the distribution uses ``Aliases`` (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in `AWS Identity and Access Management (IAM) <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html>`_ , provide the ID of the IAM certificate. If you specify an IAM certificate ID, you must also specify values for ``MinimumProtocolVersion`` and ``SSLSupportMethod`` . (In CloudFormation, the field name is ``SslSupportMethod`` . Note the different capitalization.)
10787
+ :param iam_certificate_id: .. epigraph:: This field only supports standard distributions. You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . > In CloudFormation, this field name is ``IamCertificateId`` . Note the different capitalization. If the distribution uses ``Aliases`` (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in `AWS Identity and Access Management (IAM) <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html>`_ , provide the ID of the IAM certificate. If you specify an IAM certificate ID, you must also specify values for ``MinimumProtocolVersion`` and ``SSLSupportMethod`` . (In CloudFormation, the field name is ``SslSupportMethod`` . Note the different capitalization.)
10243
10788
  :param minimum_protocol_version: If the distribution uses ``Aliases`` (alternate domain names or CNAMEs), specify the security policy that you want CloudFront to use for HTTPS connections with viewers. The security policy determines two settings: - The minimum SSL/TLS protocol that CloudFront can use to communicate with viewers. - The ciphers that CloudFront can use to encrypt the content that it returns to viewers. For more information, see `Security Policy <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValues-security-policy>`_ and `Supported Protocols and Ciphers Between Viewers and CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html#secure-connections-supported-ciphers>`_ in the *Amazon CloudFront Developer Guide* . .. epigraph:: On the CloudFront console, this setting is called *Security Policy* . When you're using SNI only (you set ``SSLSupportMethod`` to ``sni-only`` ), you must specify ``TLSv1`` or higher. (In CloudFormation, the field name is ``SslSupportMethod`` . Note the different capitalization.) If the distribution uses the CloudFront domain name such as ``d111111abcdef8.cloudfront.net`` (you set ``CloudFrontDefaultCertificate`` to ``true`` ), CloudFront automatically sets the security policy to ``TLSv1`` regardless of the value that you set here.
10244
10789
  :param ssl_support_method: .. epigraph:: In CloudFormation, this field name is ``SslSupportMethod`` . Note the different capitalization. If the distribution uses ``Aliases`` (alternate domain names or CNAMEs), specify which viewers the distribution accepts HTTPS connections from. - ``sni-only`` – The distribution accepts HTTPS connections from only viewers that support `server name indication (SNI) <https://docs.aws.amazon.com/https://en.wikipedia.org/wiki/Server_Name_Indication>`_ . This is recommended. Most browsers and clients support SNI. - ``vip`` – The distribution accepts HTTPS connections from all viewers including those that don't support SNI. This is not recommended, and results in additional monthly charges from CloudFront. - ``static-ip`` - Do not specify this value unless your distribution has been enabled for this feature by the CloudFront team. If you have a use case that requires static IP addresses for a distribution, contact CloudFront through the `Support Center <https://docs.aws.amazon.com/support/home>`_ . If the distribution uses the CloudFront domain name such as ``d111111abcdef8.cloudfront.net`` , don't set a value for this field.
10245
10790
 
@@ -10315,7 +10860,9 @@ class CfnDistribution(
10315
10860
  def iam_certificate_id(self) -> typing.Optional[builtins.str]:
10316
10861
  '''.. epigraph::
10317
10862
 
10318
- In CloudFormation, this field name is ``IamCertificateId`` . Note the different capitalization.
10863
+ This field only supports standard distributions.
10864
+
10865
+ You can't specify this field for multi-tenant distributions. For more information, see `Unsupported features for SaaS Manager for Amazon CloudFront <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-config-options.html#unsupported-saas>`_ in the *Amazon CloudFront Developer Guide* . > In CloudFormation, this field name is ``IamCertificateId`` . Note the different capitalization.
10319
10866
 
10320
10867
  If the distribution uses ``Aliases`` (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in `AWS Identity and Access Management (IAM) <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html>`_ , provide the ID of the IAM certificate.
10321
10868
 
@@ -10399,8 +10946,8 @@ class CfnDistribution(
10399
10946
  '''An Amazon CloudFront VPC origin configuration.
10400
10947
 
10401
10948
  :param vpc_origin_id: The VPC origin ID.
10402
- :param origin_keepalive_timeout: Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 5 seconds. For more information, see `Keep-alive timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginKeepaliveTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 5
10403
- :param origin_read_timeout: Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 30 seconds. For more information, see `Response timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginResponseTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 30
10949
+ :param origin_keepalive_timeout: Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 5 seconds. For more information, see `Keep-alive timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginKeepaliveTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 5
10950
+ :param origin_read_timeout: Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 30 seconds. For more information, see `Response timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginResponseTimeout>`_ in the *Amazon CloudFront Developer Guide* . Default: - 30
10404
10951
 
10405
10952
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-vpcoriginconfig.html
10406
10953
  :exampleMetadata: fixture=_generated
@@ -10446,7 +10993,7 @@ class CfnDistribution(
10446
10993
  def origin_keepalive_timeout(self) -> typing.Optional[jsii.Number]:
10447
10994
  '''Specifies how long, in seconds, CloudFront persists its connection to the origin.
10448
10995
 
10449
- The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 5 seconds.
10996
+ The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 5 seconds.
10450
10997
 
10451
10998
  For more information, see `Keep-alive timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginKeepaliveTimeout>`_ in the *Amazon CloudFront Developer Guide* .
10452
10999
 
@@ -10461,7 +11008,7 @@ class CfnDistribution(
10461
11008
  def origin_read_timeout(self) -> typing.Optional[jsii.Number]:
10462
11009
  '''Specifies how long, in seconds, CloudFront waits for a response from the origin.
10463
11010
 
10464
- This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 30 seconds.
11011
+ This is also known as the *origin response timeout* . The minimum timeout is 1 second, the maximum is 120 seconds, and the default (if you don't specify otherwise) is 30 seconds.
10465
11012
 
10466
11013
  For more information, see `Response timeout (custom origins only) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#DownloadDistValuesOriginResponseTimeout>`_ in the *Amazon CloudFront Developer Guide* .
10467
11014
 
@@ -10800,48 +11347,90 @@ class CfnDistributionTenant(
10800
11347
 
10801
11348
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html
10802
11349
  :cloudformationResource: AWS::CloudFront::DistributionTenant
10803
- :exampleMetadata: fixture=_generated
11350
+ :exampleMetadata: infused
10804
11351
 
10805
11352
  Example::
10806
11353
 
10807
- # The code below shows an example of how to instantiate this type.
10808
- # The values are placeholders you should change.
10809
- from aws_cdk import aws_cloudfront as cloudfront
11354
+ # Create the simple Origin
11355
+ my_bucket = s3.Bucket(self, "myBucket")
11356
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
11357
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
11358
+ )
10810
11359
 
10811
- cfn_distribution_tenant = cloudfront.CfnDistributionTenant(self, "MyCfnDistributionTenant",
10812
- distribution_id="distributionId",
10813
- domains=["domains"],
10814
- name="name",
11360
+ # Create the Distribution construct
11361
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
11362
+ default_behavior=cloudfront.BehaviorOptions(
11363
+ origin=s3_origin
11364
+ ),
11365
+ default_root_object="index.html"
11366
+ )
10815
11367
 
11368
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
11369
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
11370
+
11371
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
11372
+ target_origin_id=my_bucket.bucket_arn,
11373
+ viewer_protocol_policy="allow-all",
11374
+ compress=False,
11375
+ allowed_methods=["GET", "HEAD"],
11376
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
11377
+ )
11378
+ # Create the updated distributionConfig
11379
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
11380
+ default_cache_behavior=default_cache_behavior,
11381
+ enabled=True,
10816
11382
  # the properties below are optional
10817
- connection_group_id="connectionGroupId",
10818
- customizations=cloudfront.CfnDistributionTenant.CustomizationsProperty(
10819
- certificate=cloudfront.CfnDistributionTenant.CertificateProperty(
10820
- arn="arn"
10821
- ),
10822
- geo_restrictions=cloudfront.CfnDistributionTenant.GeoRestrictionCustomizationProperty(
10823
- locations=["locations"],
10824
- restriction_type="restrictionType"
10825
- ),
10826
- web_acl=cloudfront.CfnDistributionTenant.WebAclCustomizationProperty(
10827
- action="action",
10828
- arn="arn"
11383
+ connection_mode="tenant-only",
11384
+ origins=[cloudfront.CfnDistribution.OriginProperty(
11385
+ id=my_bucket.bucket_arn,
11386
+ domain_name=my_bucket.bucket_domain_name,
11387
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
11388
+ origin_path="/{{tenantName}}"
11389
+ )
11390
+ ],
11391
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
11392
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
11393
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
11394
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
11395
+ required=False,
11396
+ # the properties below are optional
11397
+ comment="tenantName",
11398
+ default_value="root"
11399
+ )
11400
+ ),
11401
+ name="tenantName"
10829
11402
  )
10830
- ),
10831
- enabled=False,
11403
+ ]
11404
+ )
11405
+ )
11406
+
11407
+ # Override the distribution configuration to enable multi-tenancy.
11408
+ cfn_distribution.distribution_config = distribution_config
11409
+
11410
+ # Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
11411
+ connection_group = cloudfront.CfnConnectionGroup(self, "self-hosted-connection-group",
11412
+ enabled=True,
11413
+ ipv6_enabled=True,
11414
+ name="self-hosted-connection-group"
11415
+ )
11416
+
11417
+ # Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
11418
+ CfnOutput(self, "RoutingEndpoint",
11419
+ value=connection_group.attr_routing_endpoint,
11420
+ description="CloudFront Routing Endpoint to be added to my hosted zone CNAME records"
11421
+ )
11422
+
11423
+ # Create a distribution tenant with a self-hosted domain.
11424
+ self_hosted_tenant = cloudfront.CfnDistributionTenant(self, "self-hosted-tenant",
11425
+ distribution_id=my_multi_tenant_distribution.distribution_id,
11426
+ connection_group_id=connection_group.attr_id,
11427
+ name="self-hosted-tenant",
11428
+ domains=["self-hosted-tenant.my.domain.com"],
11429
+ enabled=True,
10832
11430
  managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
10833
- certificate_transparency_logging_preference="certificateTransparencyLoggingPreference",
10834
- primary_domain_name="primaryDomainName",
10835
- validation_token_host="validationTokenHost"
10836
- ),
10837
- parameters=[cloudfront.CfnDistributionTenant.ParameterProperty(
10838
- name="name",
10839
- value="value"
10840
- )],
10841
- tags=[CfnTag(
10842
- key="key",
10843
- value="value"
10844
- )]
11431
+ primary_domain_name="self-hosted-tenant.my.domain.com",
11432
+ validation_token_host="self-hosted"
11433
+ )
10845
11434
  )
10846
11435
  '''
10847
11436
 
@@ -11714,48 +12303,90 @@ class CfnDistributionTenantProps:
11714
12303
  :param tags: A complex type that contains zero or more ``Tag`` elements.
11715
12304
 
11716
12305
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html
11717
- :exampleMetadata: fixture=_generated
12306
+ :exampleMetadata: infused
11718
12307
 
11719
12308
  Example::
11720
12309
 
11721
- # The code below shows an example of how to instantiate this type.
11722
- # The values are placeholders you should change.
11723
- from aws_cdk import aws_cloudfront as cloudfront
12310
+ # Create the simple Origin
12311
+ my_bucket = s3.Bucket(self, "myBucket")
12312
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
12313
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
12314
+ )
11724
12315
 
11725
- cfn_distribution_tenant_props = cloudfront.CfnDistributionTenantProps(
11726
- distribution_id="distributionId",
11727
- domains=["domains"],
11728
- name="name",
12316
+ # Create the Distribution construct
12317
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
12318
+ default_behavior=cloudfront.BehaviorOptions(
12319
+ origin=s3_origin
12320
+ ),
12321
+ default_root_object="index.html"
12322
+ )
12323
+
12324
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
12325
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
11729
12326
 
12327
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
12328
+ target_origin_id=my_bucket.bucket_arn,
12329
+ viewer_protocol_policy="allow-all",
12330
+ compress=False,
12331
+ allowed_methods=["GET", "HEAD"],
12332
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
12333
+ )
12334
+ # Create the updated distributionConfig
12335
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
12336
+ default_cache_behavior=default_cache_behavior,
12337
+ enabled=True,
11730
12338
  # the properties below are optional
11731
- connection_group_id="connectionGroupId",
11732
- customizations=cloudfront.CfnDistributionTenant.CustomizationsProperty(
11733
- certificate=cloudfront.CfnDistributionTenant.CertificateProperty(
11734
- arn="arn"
11735
- ),
11736
- geo_restrictions=cloudfront.CfnDistributionTenant.GeoRestrictionCustomizationProperty(
11737
- locations=["locations"],
11738
- restriction_type="restrictionType"
11739
- ),
11740
- web_acl=cloudfront.CfnDistributionTenant.WebAclCustomizationProperty(
11741
- action="action",
11742
- arn="arn"
12339
+ connection_mode="tenant-only",
12340
+ origins=[cloudfront.CfnDistribution.OriginProperty(
12341
+ id=my_bucket.bucket_arn,
12342
+ domain_name=my_bucket.bucket_domain_name,
12343
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
12344
+ origin_path="/{{tenantName}}"
12345
+ )
12346
+ ],
12347
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
12348
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
12349
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
12350
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
12351
+ required=False,
12352
+ # the properties below are optional
12353
+ comment="tenantName",
12354
+ default_value="root"
12355
+ )
12356
+ ),
12357
+ name="tenantName"
11743
12358
  )
11744
- ),
11745
- enabled=False,
12359
+ ]
12360
+ )
12361
+ )
12362
+
12363
+ # Override the distribution configuration to enable multi-tenancy.
12364
+ cfn_distribution.distribution_config = distribution_config
12365
+
12366
+ # Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
12367
+ connection_group = cloudfront.CfnConnectionGroup(self, "self-hosted-connection-group",
12368
+ enabled=True,
12369
+ ipv6_enabled=True,
12370
+ name="self-hosted-connection-group"
12371
+ )
12372
+
12373
+ # Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
12374
+ CfnOutput(self, "RoutingEndpoint",
12375
+ value=connection_group.attr_routing_endpoint,
12376
+ description="CloudFront Routing Endpoint to be added to my hosted zone CNAME records"
12377
+ )
12378
+
12379
+ # Create a distribution tenant with a self-hosted domain.
12380
+ self_hosted_tenant = cloudfront.CfnDistributionTenant(self, "self-hosted-tenant",
12381
+ distribution_id=my_multi_tenant_distribution.distribution_id,
12382
+ connection_group_id=connection_group.attr_id,
12383
+ name="self-hosted-tenant",
12384
+ domains=["self-hosted-tenant.my.domain.com"],
12385
+ enabled=True,
11746
12386
  managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
11747
- certificate_transparency_logging_preference="certificateTransparencyLoggingPreference",
11748
- primary_domain_name="primaryDomainName",
11749
- validation_token_host="validationTokenHost"
11750
- ),
11751
- parameters=[cloudfront.CfnDistributionTenant.ParameterProperty(
11752
- name="name",
11753
- value="value"
11754
- )],
11755
- tags=[CfnTag(
11756
- key="key",
11757
- value="value"
11758
- )]
12387
+ primary_domain_name="self-hosted-tenant.my.domain.com",
12388
+ validation_token_host="self-hosted"
12389
+ )
11759
12390
  )
11760
12391
  '''
11761
12392
  if __debug__:
@@ -18999,17 +19630,20 @@ class DistributionProps:
18999
19630
 
19000
19631
  Example::
19001
19632
 
19002
- # Creates a distribution from an Application Load Balancer
19003
- # vpc: ec2.Vpc
19004
-
19005
- # Create an application load balancer in a VPC. 'internetFacing' can be 'false'.
19006
- alb = elbv2.ApplicationLoadBalancer(self, "ALB",
19007
- vpc=vpc,
19008
- internet_facing=False,
19009
- vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_ISOLATED)
19633
+ # s3_bucket: s3.Bucket
19634
+ # Add a cloudfront Function to a Distribution
19635
+ cf_function = cloudfront.Function(self, "Function",
19636
+ code=cloudfront.FunctionCode.from_inline("function handler(event) { return event.request }"),
19637
+ runtime=cloudfront.FunctionRuntime.JS_2_0
19010
19638
  )
19011
- cloudfront.Distribution(self, "myDist",
19012
- default_behavior=cloudfront.BehaviorOptions(origin=origins.VpcOrigin.with_application_load_balancer(alb))
19639
+ cloudfront.Distribution(self, "distro",
19640
+ default_behavior=cloudfront.BehaviorOptions(
19641
+ origin=origins.S3Origin(s3_bucket),
19642
+ function_associations=[cloudfront.FunctionAssociation(
19643
+ function=cf_function,
19644
+ event_type=cloudfront.FunctionEventType.VIEWER_REQUEST
19645
+ )]
19646
+ )
19013
19647
  )
19014
19648
  '''
19015
19649
  if isinstance(default_behavior, dict):
@@ -27269,13 +27903,76 @@ class CachePolicy(
27269
27903
 
27270
27904
  Example::
27271
27905
 
27272
- # Using an existing cache policy for a Distribution
27273
- # bucket_origin: origins.S3Origin
27906
+ # Create the simple Origin
27907
+ my_bucket = s3.Bucket(self, "myBucket")
27908
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
27909
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
27910
+ )
27274
27911
 
27275
- cloudfront.Distribution(self, "myDistManagedPolicy",
27912
+ # Create the Distribution construct
27913
+ my_multi_tenant_distribution = cloudfront.Distribution(self, "distribution",
27276
27914
  default_behavior=cloudfront.BehaviorOptions(
27277
- origin=bucket_origin,
27278
- cache_policy=cloudfront.CachePolicy.CACHING_OPTIMIZED
27915
+ origin=s3_origin
27916
+ ),
27917
+ default_root_object="index.html"
27918
+ )
27919
+
27920
+ # Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
27921
+ cfn_distribution = my_multi_tenant_distribution.node.default_child
27922
+
27923
+ default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
27924
+ target_origin_id=my_bucket.bucket_arn,
27925
+ viewer_protocol_policy="allow-all",
27926
+ compress=False,
27927
+ allowed_methods=["GET", "HEAD"],
27928
+ cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
27929
+ )
27930
+ # Create the updated distributionConfig
27931
+ distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
27932
+ default_cache_behavior=default_cache_behavior,
27933
+ enabled=True,
27934
+ # the properties below are optional
27935
+ connection_mode="tenant-only",
27936
+ origins=[cloudfront.CfnDistribution.OriginProperty(
27937
+ id=my_bucket.bucket_arn,
27938
+ domain_name=my_bucket.bucket_domain_name,
27939
+ s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
27940
+ origin_path="/{{tenantName}}"
27941
+ )
27942
+ ],
27943
+ tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
27944
+ parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
27945
+ definition=cloudfront.CfnDistribution.DefinitionProperty(
27946
+ string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
27947
+ required=False,
27948
+ # the properties below are optional
27949
+ comment="tenantName",
27950
+ default_value="root"
27951
+ )
27952
+ ),
27953
+ name="tenantName"
27954
+ )
27955
+ ]
27956
+ )
27957
+ )
27958
+
27959
+ # Override the distribution configuration to enable multi-tenancy.
27960
+ cfn_distribution.distribution_config = distribution_config
27961
+
27962
+ # Create a distribution tenant using an existing ACM certificate
27963
+ cfn_distribution_tenant = cloudfront.CfnDistributionTenant(self, "distribution-tenant",
27964
+ distribution_id=my_multi_tenant_distribution.distribution_id,
27965
+ domains=["my-tenant.my.domain.com"],
27966
+ name="my-tenant",
27967
+ enabled=True,
27968
+ parameters=[cloudfront.CfnDistributionTenant.ParameterProperty(
27969
+ name="tenantName",
27970
+ value="app"
27971
+ )],
27972
+ customizations=cloudfront.CfnDistributionTenant.CustomizationsProperty(
27973
+ certificate=cloudfront.CfnDistributionTenant.CertificateProperty(
27974
+ arn="REPLACE_WITH_ARN"
27975
+ )
27279
27976
  )
27280
27977
  )
27281
27978
  '''
@@ -27656,20 +28353,19 @@ class Distribution(
27656
28353
 
27657
28354
  Example::
27658
28355
 
27659
- # Adding an existing Lambda@Edge function created in a different stack
27660
- # to a CloudFront distribution.
27661
28356
  # s3_bucket: s3.Bucket
27662
-
27663
- function_version = lambda_.Version.from_version_arn(self, "Version", "arn:aws:lambda:us-east-1:123456789012:function:functionName:1")
27664
-
28357
+ # Add a cloudfront Function to a Distribution
28358
+ cf_function = cloudfront.Function(self, "Function",
28359
+ code=cloudfront.FunctionCode.from_inline("function handler(event) { return event.request }"),
28360
+ runtime=cloudfront.FunctionRuntime.JS_2_0
28361
+ )
27665
28362
  cloudfront.Distribution(self, "distro",
27666
28363
  default_behavior=cloudfront.BehaviorOptions(
27667
28364
  origin=origins.S3Origin(s3_bucket),
27668
- edge_lambdas=[cloudfront.EdgeLambda(
27669
- function_version=function_version,
27670
- event_type=cloudfront.LambdaEdgeEventType.VIEWER_REQUEST
27671
- )
27672
- ]
28365
+ function_associations=[cloudfront.FunctionAssociation(
28366
+ function=cf_function,
28367
+ event_type=cloudfront.FunctionEventType.VIEWER_REQUEST
28368
+ )]
27673
28369
  )
27674
28370
  )
27675
28371
  '''