aws-cdk-lib 2.155.0__py3-none-any.whl → 2.156.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.

@@ -6,21 +6,503 @@ S3 buckets, Elastic Load Balancing v2 load balancers, or any other domain name.
6
6
 
7
7
  ## S3 Bucket
8
8
 
9
- An S3 bucket can be added as an origin. If the bucket is configured as a website endpoint, the distribution can use S3 redirects and S3 custom error
10
- documents.
9
+ An S3 bucket can be used as an origin. An S3 bucket origin can either be configured using a standard S3 bucket or using a S3 bucket that's configured as a website endpoint (see AWS docs for [Using an S3 Bucket](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html#using-s3-as-origin)).
10
+
11
+ > Note: `S3Origin` has been deprecated. Use `S3BucketOrigin` for standard S3 origins and `S3StaticWebsiteOrigin` for static website S3 origins.
12
+
13
+ ### Standard S3 Bucket
14
+
15
+ To set up an origin using a standard S3 bucket, use the `S3BucketOrigin` class. The bucket
16
+ is handled as a bucket origin and
17
+ CloudFront's redirect and error handling will be used. It is recommended to use `S3BucketOrigin.withOriginAccessControl()` to configure OAC for your origin.
18
+
19
+ ```python
20
+ my_bucket = s3.Bucket(self, "myBucket")
21
+ cloudfront.Distribution(self, "myDist",
22
+ default_behavior=cloudfront.BehaviorOptions(origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket))
23
+ )
24
+ ```
25
+
26
+ > Note: When you use CloudFront OAC with Amazon S3 bucket origins, you must set Amazon S3 Object Ownership to Bucket owner enforced (the default for new Amazon S3 buckets). If you require ACLs, use the Bucket owner preferred setting to maintain control over objects uploaded via CloudFront.
27
+
28
+ ### S3 Bucket Configured as a Website Endpoint
29
+
30
+ To set up an origin using an S3 bucket configured as a website endpoint, use the `S3StaticWebsiteOrigin` class. When the bucket is configured as a
31
+ website endpoint, the bucket is treated as an HTTP origin,
32
+ and the distribution can use built-in S3 redirects and S3 custom error pages.
33
+
34
+ ```python
35
+ my_bucket = s3.Bucket(self, "myBucket")
36
+ cloudfront.Distribution(self, "myDist",
37
+ default_behavior=cloudfront.BehaviorOptions(origin=origins.S3StaticWebsiteOrigin(my_bucket))
38
+ )
39
+ ```
40
+
41
+ ### Restricting access to a standard S3 Origin
42
+
43
+ CloudFront provides two ways to send authenticated requests to a standard Amazon S3 origin:
44
+
45
+ * origin access control (OAC) and
46
+ * origin access identity (OAI)
47
+
48
+ OAI is considered legacy due to limited functionality and regional
49
+ limitations, whereas OAC is recommended because it supports all Amazon S3
50
+ buckets in all AWS Regions, Amazon S3 server-side encryption with AWS KMS (SSE-KMS), and dynamic requests (PUT and DELETE) to Amazon S3. Additionally,
51
+ OAC provides stronger security posture with short term credentials,
52
+ and more frequent credential rotations as compared to OAI. OAI and OAC can be used in conjunction with a bucket that is not public to
53
+ require that your users access your content using CloudFront URLs and not S3 URLs directly.
54
+
55
+ See AWS docs on [Restricting access to an Amazon S3 Origin](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html) for more details.
56
+
57
+ > Note: OAC and OAI can only be used with an regular S3 bucket origin (not a bucket configured as a website endpoint).
58
+
59
+ The `S3BucketOrigin` class supports creating a standard S3 origin with OAC, OAI, and no access control (using your bucket access settings) via
60
+ the `withOriginAccessControl()`, `withOriginAccessIdentity()`, and `withBucketDefaults()` methods respectively.
61
+
62
+ #### Setting up a new origin access control (OAC)
63
+
64
+ Setup a standard S3 origin with origin access control as follows:
65
+
66
+ ```python
67
+ my_bucket = s3.Bucket(self, "myBucket")
68
+ cloudfront.Distribution(self, "myDist",
69
+ default_behavior=cloudfront.BehaviorOptions(
70
+ origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket)
71
+ )
72
+ )
73
+ ```
74
+
75
+ When creating a standard S3 origin using `origins.S3BucketOrigin.withOriginAccessControl()`, an [Origin Access Control resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-originaccesscontrol-originaccesscontrolconfig.html) is automatically created with the origin type set to `s3` and signing behavior set to `always`.
76
+
77
+ You can grant read, write or delete access to the OAC using the `originAccessLevels` property:
78
+
79
+ ```python
80
+ my_bucket = s3.Bucket(self, "myBucket")
81
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
82
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.WRITE, cloudfront.AccessLevel.DELETE]
83
+ )
84
+ ```
85
+
86
+ You can also pass in a custom S3 origin access control:
87
+
88
+ ```python
89
+ my_bucket = s3.Bucket(self, "myBucket")
90
+ oac = cloudfront.S3OriginAccessControl(self, "MyOAC",
91
+ signing=cloudfront.Signing.SIGV4_NO_OVERRIDE
92
+ )
93
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
94
+ origin_access_control=oac
95
+ )
96
+ cloudfront.Distribution(self, "myDist",
97
+ default_behavior=cloudfront.BehaviorOptions(
98
+ origin=s3_origin
99
+ )
100
+ )
101
+ ```
102
+
103
+ An existing S3 origin access control can be imported using the `fromOriginAccessControlId` method:
104
+
105
+ ```python
106
+ imported_oAC = cloudfront.S3OriginAccessControl.from_origin_access_control_id(self, "myImportedOAC", "ABC123ABC123AB")
107
+ ```
108
+
109
+ > [Note](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html): When you use OAC with S3
110
+ > bucket origins, the bucket's object ownership must be either set to Bucket owner enforced (default for new S3 buckets) or Bucket owner preferred (only if you require ACLs).
111
+
112
+ #### Setting up OAC with a SSE-KMS encrypted S3 origin
113
+
114
+ If the objects in the S3 bucket origin are encrypted using server-side encryption with
115
+ AWS Key Management Service (SSE-KMS), the OAC must have permission to use the KMS key.
116
+
117
+ Setting up a standard S3 origin using `S3BucketOrigin.withOriginAccessControl()` will automatically add the statement to the KMS key policy
118
+ to give the OAC permission to use the KMS key.
119
+
120
+ ```python
121
+ import aws_cdk.aws_kms as kms
122
+
123
+
124
+ my_kms_key = kms.Key(self, "myKMSKey")
125
+ my_bucket = s3.Bucket(self, "mySSEKMSEncryptedBucket",
126
+ encryption=s3.BucketEncryption.KMS,
127
+ encryption_key=my_kms_key,
128
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
129
+ )
130
+ cloudfront.Distribution(self, "myDist",
131
+ default_behavior=cloudfront.BehaviorOptions(
132
+ origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket)
133
+ )
134
+ )
135
+ ```
136
+
137
+ ##### Scoping down the key policy
138
+
139
+ I saw this warning message during synth time. What do I do?
140
+
141
+ ```text
142
+ To avoid a circular dependency between the KMS key, Bucket, and Distribution during the initial deployment, a wildcard is used in the Key policy condition to match all Distribution IDs.
143
+ After deploying once, it is strongly recommended to further scope down the policy for best security practices by following the guidance in the "Using OAC for a SSE-KMS encrypted S3 origin" section in the module README.
144
+ ```
145
+
146
+ If the S3 bucket has an `encryptionKey` defined, `S3BucketOrigin.withOriginAccessControl()`
147
+ will automatically add the following policy statement to the KMS key policy to allow CloudFront read-only access (unless otherwise specified in the `originAccessLevels` property).
148
+
149
+ ```json
150
+ {
151
+ "Statement": {
152
+ "Effect": "Allow",
153
+ "Principal": {
154
+ "Service": "cloudfront.amazonaws.com"
155
+ },
156
+ "Action": "kms:Decrypt",
157
+ "Resource": "*",
158
+ "Condition": {
159
+ "ArnLike": {
160
+ "AWS:SourceArn": "arn:aws:cloudfront::<account ID>:distribution/*"
161
+ }
162
+ }
163
+ }
164
+ }
165
+ ```
166
+
167
+ This policy uses a wildcard to match all distribution IDs in the account instead of referencing the specific distribution ID to resolve the circular dependency. The policy statement is not as scoped down as the example in the AWS CloudFront docs (see [SSE-KMS section](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#create-oac-overview-s3)).
168
+
169
+ After you have deployed the Distribution, you should follow these steps to only grant permissions to the specific distribution according to AWS best practices:
170
+
171
+ **Step 1.** Copy the key policy
172
+
173
+ **Step 2.** Use an escape hatch to update the policy statement condition so that
174
+
175
+ ```json
176
+ "Condition": {
177
+ "ArnLike": {
178
+ "AWS:SourceArn": "arn:aws:cloudfront::<account ID>:distribution/*"
179
+ }
180
+ }
181
+ ```
182
+
183
+ ...becomes...
184
+
185
+ ```json
186
+ "Condition": {
187
+ "StringEquals": {
188
+ "AWS:SourceArn": "arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>"
189
+ }
190
+ }
191
+ ```
192
+
193
+ > Note the change of condition operator from `ArnLike` to `StringEquals` in addition to replacing the wildcard (`*`) with the distribution ID.
194
+
195
+ To set the key policy using an escape hatch:
196
+
197
+ ```python
198
+ import aws_cdk.aws_kms as kms
199
+
200
+
201
+ kms_key = kms.Key(self, "myKMSKey")
202
+ my_bucket = s3.Bucket(self, "mySSEKMSEncryptedBucket",
203
+ encryption=s3.BucketEncryption.KMS,
204
+ encryption_key=kms_key,
205
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
206
+ )
207
+ cloudfront.Distribution(self, "myDist",
208
+ default_behavior=cloudfront.BehaviorOptions(
209
+ origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket)
210
+ )
211
+ )
212
+
213
+ # Add the following to scope down the key policy
214
+ scoped_down_key_policy = {
215
+ "Version": "2012-10-17",
216
+ "Statement": [{
217
+ "Effect": "Allow",
218
+ "Principal": {
219
+ "AWS": "arn:aws:iam::111122223333:root"
220
+ },
221
+ "Action": "kms:*",
222
+ "Resource": "*"
223
+ }, {
224
+ "Effect": "Allow",
225
+ "Principal": {
226
+ "Service": "cloudfront.amazonaws.com"
227
+ },
228
+ "Action": ["kms:Decrypt", "kms:Encrypt", "kms:GenerateDataKey*"
229
+ ],
230
+ "Resource": "*",
231
+ "Condition": {
232
+ "StringEquals": {
233
+ "AWS:SourceArn": "arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>"
234
+ }
235
+ }
236
+ }
237
+ ]
238
+ }
239
+ cfn_key = (kms_key.node.default_child)
240
+ cfn_key.key_policy = scoped_down_key_policy
241
+ ```
242
+
243
+ **Step 3.** Deploy the stack
244
+
245
+ > Tip: Run `cdk diff` before deploying to verify the
246
+ > changes to your stack.
247
+
248
+ **Step 4.** Verify your final key policy includes the following statement after deploying:
249
+
250
+ ```json
251
+ {
252
+ "Effect": "Allow",
253
+ "Principal": {
254
+ "Service": [
255
+ "cloudfront.amazonaws.com"
256
+ ]
257
+ },
258
+ "Action": [
259
+ "kms:Decrypt",
260
+ "kms:Encrypt",
261
+ "kms:GenerateDataKey*"
262
+ ],
263
+ "Resource": "*",
264
+ "Condition": {
265
+ "StringEquals": {
266
+ "AWS:SourceArn": "arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>"
267
+ }
268
+ }
269
+ }
270
+ ```
271
+
272
+ ##### Updating imported key policies
273
+
274
+ If you are using an imported KMS key to encrypt your S3 bucket and want to use OAC, you will need to update the
275
+ key policy manually to allow CloudFront to use the key. Like most imported resources, CDK apps cannot modify the configuration of imported keys.
276
+
277
+ After deploying the distribution, add the following policy statement to your key policy to allow CloudFront OAC to access your KMS key for SSE-KMS:
278
+
279
+ ```json
280
+ {
281
+ "Sid": "AllowCloudFrontServicePrincipalSSE-KMS",
282
+ "Effect": "Allow",
283
+ "Principal": {
284
+ "Service": [
285
+ "cloudfront.amazonaws.com"
286
+ ]
287
+ },
288
+ "Action": [
289
+ "kms:Decrypt",
290
+ "kms:Encrypt",
291
+ "kms:GenerateDataKey*"
292
+ ],
293
+ "Resource": "*",
294
+ "Condition": {
295
+ "StringEquals": {
296
+ "AWS:SourceArn": "arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>"
297
+ }
298
+ }
299
+ }
300
+ ```
301
+
302
+ See CloudFront docs on [SSE-KMS](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#create-oac-overview-s3) for more details.
303
+
304
+ #### Setting up OAC with imported S3 buckets
305
+
306
+ If you are using an imported bucket for your S3 Origin and want to use OAC,
307
+ you will need to update
308
+ the S3 bucket policy manually to allow the OAC to access the S3 origin. Like most imported resources, CDK apps cannot modify the configuration of imported buckets.
309
+
310
+ After deploying the distribution, add the following
311
+ policy statement to your
312
+ S3 bucket to allow CloudFront read-only access
313
+ (or additional S3 permissions as required):
314
+
315
+ ```json
316
+ {
317
+ "Version": "2012-10-17",
318
+ "Statement": {
319
+ "Effect": "Allow",
320
+ "Principal": {
321
+ "Service": "cloudfront.amazonaws.com"
322
+ },
323
+ "Action": "s3:GetObject",
324
+ "Resource": "arn:aws:s3:::<S3 bucket name>/*",
325
+ "Condition": {
326
+ "StringEquals": {
327
+ "AWS:SourceArn": "arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>"
328
+ }
329
+ }
330
+ }
331
+ }
332
+ ```
333
+
334
+ See CloudFront docs on [Giving the origin access control permission to access the S3 bucket](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#create-oac-overview-s3) for more details.
335
+
336
+ > Note: If your bucket previously used OAI, you will need to manually remove the policy statement
337
+ > that gives the OAI access to your bucket after setting up OAC.
338
+
339
+ #### Setting up an OAI (legacy)
340
+
341
+ Setup an S3 origin with origin access identity (legacy) as follows:
342
+
343
+ ```python
344
+ my_bucket = s3.Bucket(self, "myBucket")
345
+ cloudfront.Distribution(self, "myDist",
346
+ default_behavior=cloudfront.BehaviorOptions(
347
+ origin=origins.S3BucketOrigin.with_origin_access_identity(my_bucket)
348
+ )
349
+ )
350
+ ```
351
+
352
+ You can also pass in a custom S3 origin access identity:
353
+
354
+ ```python
355
+ my_bucket = s3.Bucket(self, "myBucket")
356
+ my_oai = cloudfront.OriginAccessIdentity(self, "myOAI",
357
+ comment="My custom OAI"
358
+ )
359
+ s3_origin = origins.S3BucketOrigin.with_origin_access_identity(my_bucket,
360
+ origin_access_identity=my_oai
361
+ )
362
+ cloudfront.Distribution(self, "myDist",
363
+ default_behavior=cloudfront.BehaviorOptions(
364
+ origin=s3_origin
365
+ )
366
+ )
367
+ ```
368
+
369
+ #### Setting up OAI with imported S3 buckets (legacy)
370
+
371
+ If you are using an imported bucket for your S3 Origin and want to use OAI,
372
+ you will need to update
373
+ the S3 bucket policy manually to allow the OAI to access the S3 origin. Like most imported resources, CDK apps cannot modify the configuration of imported buckets.
374
+
375
+ Add the following
376
+ policy statement to your
377
+ S3 bucket to allow the OAI read access:
378
+
379
+ ```json
380
+ {
381
+ "Version": "2012-10-17",
382
+ "Id": "PolicyForCloudFrontPrivateContent",
383
+ "Statement": [
384
+ {
385
+ "Effect": "Allow",
386
+ "Principal": {
387
+ "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity <origin access identity ID>"
388
+ },
389
+ "Action": "s3:GetObject",
390
+ "Resource": "arn:aws:s3:::<S3 bucket name>/*"
391
+ }
392
+ ]
393
+ }
394
+ ```
395
+
396
+ See AWS docs on [Giving an origin access identity permission to read files in the Amazon S3 bucket](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#private-content-restricting-access-to-s3-oai) for more details.
397
+
398
+ ### Setting up a S3 origin with no origin access control
399
+
400
+ To setup a standard S3 origin with no access control (no OAI nor OAC), use `origins.S3BucketOrigin.withBucketDefaults()`:
11
401
 
12
402
  ```python
13
403
  my_bucket = s3.Bucket(self, "myBucket")
14
404
  cloudfront.Distribution(self, "myDist",
15
- default_behavior=cloudfront.BehaviorOptions(origin=origins.S3Origin(my_bucket))
405
+ default_behavior=cloudfront.BehaviorOptions(
406
+ origin=origins.S3BucketOrigin.with_bucket_defaults(my_bucket)
407
+ )
408
+ )
409
+ ```
410
+
411
+ ### Migrating from OAI to OAC
412
+
413
+ If you are currently using OAI for your S3 origin and wish to migrate to OAC,
414
+ replace the `S3Origin` construct (deprecated) with `S3BucketOrigin.withOriginAccessControl()` which automatically
415
+ creates and sets up an OAC for you.
416
+
417
+ Existing setup using OAI and `S3Origin`:
418
+
419
+ ```python
420
+ my_bucket = s3.Bucket(self, "myBucket")
421
+ s3_origin = origins.S3Origin(my_bucket)
422
+ distribution = cloudfront.Distribution(self, "myDist",
423
+ default_behavior=cloudfront.BehaviorOptions(origin=s3_origin)
424
+ )
425
+ ```
426
+
427
+ **Step 1:**
428
+
429
+ To ensure CloudFront doesn't lose access to the bucket during the transition, add a statement to bucket policy to grant OAC access to the S3 origin. Deploy the stack. If you are okay with downtime during the transition, you can skip this step.
430
+
431
+ > Tip: Run `cdk diff` before deploying to verify the
432
+ > changes to your stack.
433
+
434
+ ```python
435
+ import aws_cdk as cdk
436
+ import aws_cdk.aws_iam as iam
437
+
438
+
439
+ stack = Stack()
440
+ my_bucket = s3.Bucket(self, "myBucket")
441
+ s3_origin = origins.S3Origin(my_bucket)
442
+ distribution = cloudfront.Distribution(self, "myDist",
443
+ default_behavior=cloudfront.BehaviorOptions(origin=s3_origin)
444
+ )
445
+
446
+ # Construct the bucket policy statement
447
+ distribution_arn = stack.format_arn(
448
+ service="cloudfront",
449
+ region="",
450
+ resource="distribution",
451
+ resource_name=distribution.distribution_id,
452
+ arn_format=cdk.ArnFormat.SLASH_RESOURCE_NAME
453
+ )
454
+
455
+ cloudfront_sP = iam.ServicePrincipal("cloudfront.amazonaws.com")
456
+
457
+ oac_bucket_policy_statement = iam.PolicyStatement(
458
+ effect=iam.Effect.ALLOW,
459
+ principals=[cloudfront_sP],
460
+ actions=["s3:GetObject"],
461
+ resources=[my_bucket.arn_for_objects("*")],
462
+ conditions={
463
+ "StringEquals": {
464
+ "AWS:SourceArn": distribution_arn
465
+ }
466
+ }
467
+ )
468
+
469
+ # Add statement to bucket policy
470
+ my_bucket.add_to_resource_policy(oac_bucket_policy_statement)
471
+ ```
472
+
473
+ The following changes will take place:
474
+
475
+ 1. The bucket policy will be modified to grant the CloudFront distribution access. At this point the bucket policy allows both an OAI and an OAC to access the S3 origin.
476
+
477
+ **Step 2:**
478
+
479
+ Replace `S3Origin` with `S3BucketOrigin.withOriginAccessControl()`, which creates an OAC and attaches it to the distribution. You can remove the code from Step 1 which updated the bucket policy, as `S3BucketOrigin.withOriginAccessControl()` updates the bucket policy automatically with the same statement when defined in the `Distribution` (no net difference).
480
+
481
+ Run `cdk diff` before deploying to verify the changes to your stack.
482
+
483
+ ```python
484
+ bucket = s3.Bucket(self, "Bucket")
485
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(bucket)
486
+ distribution = cloudfront.Distribution(self, "Distribution",
487
+ default_behavior=cloudfront.BehaviorOptions(origin=s3_origin)
16
488
  )
17
489
  ```
18
490
 
19
- The above will treat the bucket differently based on if `IBucket.isWebsite` is set or not. If the bucket is configured as a website, the bucket is
20
- treated as an HTTP origin, and the built-in S3 redirects and error pages can be used. Otherwise, the bucket is handled as a bucket origin and
21
- CloudFront's redirect and error handling will be used. In the latter case, the Origin will create an origin access identity and grant it access to the
22
- underlying bucket. This can be used in conjunction with a bucket that is not public to require that your users access your content using CloudFront
23
- URLs and not S3 URLs directly. Alternatively, a custom origin access identity can be passed to the S3 origin in the properties.
491
+ The following changes will take place:
492
+
493
+ 1. A `AWS::CloudFront::OriginAccessControl` resource will be created.
494
+ 2. The `Origin` property of the `AWS::CloudFront::Distribution` will set [`OriginAccessControlId`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-originaccesscontrolid) to the OAC ID after it is created. It will also set [`S3OriginConfig`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-s3originconfig.html#aws-properties-cloudfront-distribution-s3originconfig-properties) to `{"OriginAccessIdentity": ""}`, which deletes the origin access identity from the existing distribution.
495
+ 3. The `AWS::CloudFront::CloudFrontOriginAccessIdentity` resource will be deleted.
496
+
497
+ **Will migrating from OAI to OAC cause any resource replacement?**
498
+
499
+ No, following the migration steps does not cause any replacement of the existing `AWS::CloudFront::Distribution`, `AWS::S3::Bucket` nor `AWS::S3::BucketPolicy` resources. It will modify the bucket policy, create a `AWS::CloudFront::OriginAccessControl` resource, and delete the existing `AWS::CloudFront::CloudFrontOriginAccessIdentity`.
500
+
501
+ **Will migrating from OAI to OAC have any availability implications for my application?**
502
+
503
+ Updates to bucket policies are eventually consistent. Therefore, removing OAI permissions and setting up OAC in the same CloudFormation stack deployment is not recommended as it may cause downtime where CloudFront loses access to the bucket. Following the steps outlined above lowers the risk of downtime as the bucket policy is updated to have both OAI and OAC permissions, then in a subsequent deployment, the OAI permissions are removed.
504
+
505
+ For more information, see [Migrating from origin access identity (OAI) to origin access control (OAC)](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#migrate-from-oai-to-oac).
24
506
 
25
507
  ### Adding Custom Headers
26
508
 
@@ -29,7 +511,7 @@ You can configure CloudFront to add custom headers to the requests that it sends
29
511
  ```python
30
512
  my_bucket = s3.Bucket(self, "myBucket")
31
513
  cloudfront.Distribution(self, "myDist",
32
- default_behavior=cloudfront.BehaviorOptions(origin=origins.S3Origin(my_bucket,
514
+ default_behavior=cloudfront.BehaviorOptions(origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket,
33
515
  custom_headers={
34
516
  "Foo": "bar"
35
517
  }
@@ -104,7 +586,7 @@ my_bucket = s3.Bucket(self, "myBucket")
104
586
  cloudfront.Distribution(self, "myDist",
105
587
  default_behavior=cloudfront.BehaviorOptions(
106
588
  origin=origins.OriginGroup(
107
- primary_origin=origins.S3Origin(my_bucket),
589
+ primary_origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket),
108
590
  fallback_origin=origins.HttpOrigin("www.example.com"),
109
591
  # optional, defaults to: 500, 502, 503 and 504
110
592
  fallback_status_codes=[404]
@@ -173,8 +655,10 @@ import constructs as _constructs_77d1e7e8
173
655
  from .. import Duration as _Duration_4839e8c3
174
656
  from ..aws_apigateway import RestApiBase as _RestApiBase_0431da32
175
657
  from ..aws_cloudfront import (
658
+ AccessLevel as _AccessLevel_315d9a76,
176
659
  CfnDistribution as _CfnDistribution_d9ad3595,
177
660
  IOrigin as _IOrigin_83d4c1fa,
661
+ IOriginAccessControl as _IOriginAccessControl_82a6fe5a,
178
662
  IOriginAccessIdentity as _IOriginAccessIdentity_a922494c,
179
663
  OriginBase as _OriginBase_b8fe5bcc,
180
664
  OriginBindConfig as _OriginBindConfig_25a57096,
@@ -220,6 +704,7 @@ class FunctionUrlOrigin(
220
704
  connection_attempts: typing.Optional[jsii.Number] = None,
221
705
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
222
706
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
707
+ origin_access_control_id: typing.Optional[builtins.str] = None,
223
708
  origin_id: typing.Optional[builtins.str] = None,
224
709
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
225
710
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -232,6 +717,7 @@ class FunctionUrlOrigin(
232
717
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
233
718
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
234
719
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
720
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
235
721
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
236
722
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
237
723
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -246,6 +732,7 @@ class FunctionUrlOrigin(
246
732
  connection_attempts=connection_attempts,
247
733
  connection_timeout=connection_timeout,
248
734
  custom_headers=custom_headers,
735
+ origin_access_control_id=origin_access_control_id,
249
736
  origin_id=origin_id,
250
737
  origin_shield_enabled=origin_shield_enabled,
251
738
  origin_shield_region=origin_shield_region,
@@ -267,6 +754,7 @@ class FunctionUrlOrigin(
267
754
  "connection_attempts": "connectionAttempts",
268
755
  "connection_timeout": "connectionTimeout",
269
756
  "custom_headers": "customHeaders",
757
+ "origin_access_control_id": "originAccessControlId",
270
758
  "origin_id": "originId",
271
759
  "origin_shield_enabled": "originShieldEnabled",
272
760
  "origin_shield_region": "originShieldRegion",
@@ -282,6 +770,7 @@ class FunctionUrlOriginProps(_OriginProps_0675928d):
282
770
  connection_attempts: typing.Optional[jsii.Number] = None,
283
771
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
284
772
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
773
+ origin_access_control_id: typing.Optional[builtins.str] = None,
285
774
  origin_id: typing.Optional[builtins.str] = None,
286
775
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
287
776
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -294,6 +783,7 @@ class FunctionUrlOriginProps(_OriginProps_0675928d):
294
783
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
295
784
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
296
785
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
786
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
297
787
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
298
788
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
299
789
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -317,6 +807,7 @@ class FunctionUrlOriginProps(_OriginProps_0675928d):
317
807
  "custom_headers_key": "customHeaders"
318
808
  },
319
809
  keepalive_timeout=cdk.Duration.minutes(30),
810
+ origin_access_control_id="originAccessControlId",
320
811
  origin_id="originId",
321
812
  origin_path="originPath",
322
813
  origin_shield_enabled=False,
@@ -329,6 +820,7 @@ class FunctionUrlOriginProps(_OriginProps_0675928d):
329
820
  check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
330
821
  check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
331
822
  check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
823
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
332
824
  check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
333
825
  check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
334
826
  check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
@@ -342,6 +834,8 @@ class FunctionUrlOriginProps(_OriginProps_0675928d):
342
834
  self._values["connection_timeout"] = connection_timeout
343
835
  if custom_headers is not None:
344
836
  self._values["custom_headers"] = custom_headers
837
+ if origin_access_control_id is not None:
838
+ self._values["origin_access_control_id"] = origin_access_control_id
345
839
  if origin_id is not None:
346
840
  self._values["origin_id"] = origin_id
347
841
  if origin_shield_enabled is not None:
@@ -388,6 +882,15 @@ class FunctionUrlOriginProps(_OriginProps_0675928d):
388
882
  result = self._values.get("custom_headers")
389
883
  return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
390
884
 
885
+ @builtins.property
886
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
887
+ '''The unique identifier of an origin access control for this origin.
888
+
889
+ :default: - no origin access control
890
+ '''
891
+ result = self._values.get("origin_access_control_id")
892
+ return typing.cast(typing.Optional[builtins.str], result)
893
+
391
894
  @builtins.property
392
895
  def origin_id(self) -> typing.Optional[builtins.str]:
393
896
  '''A unique identifier for the origin.
@@ -481,25 +984,26 @@ class HttpOrigin(
481
984
 
482
985
  Example::
483
986
 
484
- # Validating signed URLs or signed cookies with Trusted Key Groups
987
+ # Adding realtime logs config to a Cloudfront Distribution on default behavior.
988
+ import aws_cdk.aws_kinesis as kinesis
485
989
 
486
- # public key in PEM format
487
- # public_key: str
990
+ # stream: kinesis.Stream
488
991
 
489
- pub_key = cloudfront.PublicKey(self, "MyPubKey",
490
- encoded_key=public_key
491
- )
492
992
 
493
- key_group = cloudfront.KeyGroup(self, "MyKeyGroup",
494
- items=[pub_key
495
- ]
993
+ real_time_config = cloudfront.RealtimeLogConfig(self, "realtimeLog",
994
+ end_points=[
995
+ cloudfront.Endpoint.from_kinesis_stream(stream)
996
+ ],
997
+ fields=["timestamp", "c-ip", "time-to-first-byte", "sc-status"
998
+ ],
999
+ realtime_log_config_name="my-delivery-stream",
1000
+ sampling_rate=100
496
1001
  )
497
1002
 
498
- cloudfront.Distribution(self, "Dist",
1003
+ cloudfront.Distribution(self, "myCdn",
499
1004
  default_behavior=cloudfront.BehaviorOptions(
500
1005
  origin=origins.HttpOrigin("www.example.com"),
501
- trusted_key_groups=[key_group
502
- ]
1006
+ realtime_log_config=real_time_config
503
1007
  )
504
1008
  )
505
1009
  '''
@@ -518,6 +1022,7 @@ class HttpOrigin(
518
1022
  connection_attempts: typing.Optional[jsii.Number] = None,
519
1023
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
520
1024
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
1025
+ origin_access_control_id: typing.Optional[builtins.str] = None,
521
1026
  origin_id: typing.Optional[builtins.str] = None,
522
1027
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
523
1028
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -534,6 +1039,7 @@ class HttpOrigin(
534
1039
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
535
1040
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
536
1041
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
1042
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
537
1043
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
538
1044
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
539
1045
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -552,6 +1058,7 @@ class HttpOrigin(
552
1058
  connection_attempts=connection_attempts,
553
1059
  connection_timeout=connection_timeout,
554
1060
  custom_headers=custom_headers,
1061
+ origin_access_control_id=origin_access_control_id,
555
1062
  origin_id=origin_id,
556
1063
  origin_shield_enabled=origin_shield_enabled,
557
1064
  origin_shield_region=origin_shield_region,
@@ -573,6 +1080,7 @@ class HttpOrigin(
573
1080
  "connection_attempts": "connectionAttempts",
574
1081
  "connection_timeout": "connectionTimeout",
575
1082
  "custom_headers": "customHeaders",
1083
+ "origin_access_control_id": "originAccessControlId",
576
1084
  "origin_id": "originId",
577
1085
  "origin_shield_enabled": "originShieldEnabled",
578
1086
  "origin_shield_region": "originShieldRegion",
@@ -592,6 +1100,7 @@ class HttpOriginProps(_OriginProps_0675928d):
592
1100
  connection_attempts: typing.Optional[jsii.Number] = None,
593
1101
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
594
1102
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
1103
+ origin_access_control_id: typing.Optional[builtins.str] = None,
595
1104
  origin_id: typing.Optional[builtins.str] = None,
596
1105
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
597
1106
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -608,6 +1117,7 @@ class HttpOriginProps(_OriginProps_0675928d):
608
1117
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
609
1118
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
610
1119
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
1120
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
611
1121
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
612
1122
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
613
1123
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -638,6 +1148,7 @@ class HttpOriginProps(_OriginProps_0675928d):
638
1148
  http_port=123,
639
1149
  https_port=123,
640
1150
  keepalive_timeout=cdk.Duration.minutes(30),
1151
+ origin_access_control_id="originAccessControlId",
641
1152
  origin_id="originId",
642
1153
  origin_path="originPath",
643
1154
  origin_shield_enabled=False,
@@ -652,6 +1163,7 @@ class HttpOriginProps(_OriginProps_0675928d):
652
1163
  check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
653
1164
  check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
654
1165
  check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
1166
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
655
1167
  check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
656
1168
  check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
657
1169
  check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
@@ -669,6 +1181,8 @@ class HttpOriginProps(_OriginProps_0675928d):
669
1181
  self._values["connection_timeout"] = connection_timeout
670
1182
  if custom_headers is not None:
671
1183
  self._values["custom_headers"] = custom_headers
1184
+ if origin_access_control_id is not None:
1185
+ self._values["origin_access_control_id"] = origin_access_control_id
672
1186
  if origin_id is not None:
673
1187
  self._values["origin_id"] = origin_id
674
1188
  if origin_shield_enabled is not None:
@@ -723,6 +1237,15 @@ class HttpOriginProps(_OriginProps_0675928d):
723
1237
  result = self._values.get("custom_headers")
724
1238
  return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
725
1239
 
1240
+ @builtins.property
1241
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
1242
+ '''The unique identifier of an origin access control for this origin.
1243
+
1244
+ :default: - no origin access control
1245
+ '''
1246
+ result = self._values.get("origin_access_control_id")
1247
+ return typing.cast(typing.Optional[builtins.str], result)
1248
+
726
1249
  @builtins.property
727
1250
  def origin_id(self) -> typing.Optional[builtins.str]:
728
1251
  '''A unique identifier for the origin.
@@ -884,6 +1407,7 @@ class LoadBalancerV2Origin(
884
1407
  connection_attempts: typing.Optional[jsii.Number] = None,
885
1408
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
886
1409
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
1410
+ origin_access_control_id: typing.Optional[builtins.str] = None,
887
1411
  origin_id: typing.Optional[builtins.str] = None,
888
1412
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
889
1413
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -900,6 +1424,7 @@ class LoadBalancerV2Origin(
900
1424
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
901
1425
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
902
1426
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
1427
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
903
1428
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
904
1429
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
905
1430
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -918,6 +1443,7 @@ class LoadBalancerV2Origin(
918
1443
  connection_attempts=connection_attempts,
919
1444
  connection_timeout=connection_timeout,
920
1445
  custom_headers=custom_headers,
1446
+ origin_access_control_id=origin_access_control_id,
921
1447
  origin_id=origin_id,
922
1448
  origin_shield_enabled=origin_shield_enabled,
923
1449
  origin_shield_region=origin_shield_region,
@@ -933,6 +1459,7 @@ class LoadBalancerV2Origin(
933
1459
  "connection_attempts": "connectionAttempts",
934
1460
  "connection_timeout": "connectionTimeout",
935
1461
  "custom_headers": "customHeaders",
1462
+ "origin_access_control_id": "originAccessControlId",
936
1463
  "origin_id": "originId",
937
1464
  "origin_shield_enabled": "originShieldEnabled",
938
1465
  "origin_shield_region": "originShieldRegion",
@@ -952,6 +1479,7 @@ class LoadBalancerV2OriginProps(HttpOriginProps):
952
1479
  connection_attempts: typing.Optional[jsii.Number] = None,
953
1480
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
954
1481
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
1482
+ origin_access_control_id: typing.Optional[builtins.str] = None,
955
1483
  origin_id: typing.Optional[builtins.str] = None,
956
1484
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
957
1485
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -968,6 +1496,7 @@ class LoadBalancerV2OriginProps(HttpOriginProps):
968
1496
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
969
1497
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
970
1498
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
1499
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
971
1500
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
972
1501
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
973
1502
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -1000,6 +1529,7 @@ class LoadBalancerV2OriginProps(HttpOriginProps):
1000
1529
  check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
1001
1530
  check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
1002
1531
  check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
1532
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
1003
1533
  check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
1004
1534
  check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
1005
1535
  check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
@@ -1017,6 +1547,8 @@ class LoadBalancerV2OriginProps(HttpOriginProps):
1017
1547
  self._values["connection_timeout"] = connection_timeout
1018
1548
  if custom_headers is not None:
1019
1549
  self._values["custom_headers"] = custom_headers
1550
+ if origin_access_control_id is not None:
1551
+ self._values["origin_access_control_id"] = origin_access_control_id
1020
1552
  if origin_id is not None:
1021
1553
  self._values["origin_id"] = origin_id
1022
1554
  if origin_shield_enabled is not None:
@@ -1071,6 +1603,15 @@ class LoadBalancerV2OriginProps(HttpOriginProps):
1071
1603
  result = self._values.get("custom_headers")
1072
1604
  return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
1073
1605
 
1606
+ @builtins.property
1607
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
1608
+ '''The unique identifier of an origin access control for this origin.
1609
+
1610
+ :default: - no origin access control
1611
+ '''
1612
+ result = self._values.get("origin_access_control_id")
1613
+ return typing.cast(typing.Optional[builtins.str], result)
1614
+
1074
1615
  @builtins.property
1075
1616
  def origin_id(self) -> typing.Optional[builtins.str]:
1076
1617
  '''A unique identifier for the origin.
@@ -1209,7 +1750,7 @@ class OriginGroup(
1209
1750
  cloudfront.Distribution(self, "myDist",
1210
1751
  default_behavior=cloudfront.BehaviorOptions(
1211
1752
  origin=origins.OriginGroup(
1212
- primary_origin=origins.S3Origin(my_bucket),
1753
+ primary_origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket),
1213
1754
  fallback_origin=origins.HttpOrigin("www.example.com"),
1214
1755
  # optional, defaults to: 500, 502, 503 and 504
1215
1756
  fallback_status_codes=[404]
@@ -1244,16 +1785,20 @@ class OriginGroup(
1244
1785
  scope: _constructs_77d1e7e8.Construct,
1245
1786
  *,
1246
1787
  origin_id: builtins.str,
1788
+ distribution_id: typing.Optional[builtins.str] = None,
1247
1789
  ) -> _OriginBindConfig_25a57096:
1248
1790
  '''The method called when a given Origin is added (for the first time) to a Distribution.
1249
1791
 
1250
1792
  :param scope: -
1251
1793
  :param origin_id: The identifier of this Origin, as assigned by the Distribution this Origin has been used added to.
1794
+ :param distribution_id: The identifier of the Distribution this Origin is used for. This is used to grant origin access permissions to the distribution for origin access control. Default: - no distribution id
1252
1795
  '''
1253
1796
  if __debug__:
1254
1797
  type_hints = typing.get_type_hints(_typecheckingstub__428f309ea8c48c002d77db24802c77164c9607d40492e08c4b243080f941ff61)
1255
1798
  check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
1256
- options = _OriginBindOptions_088c2b51(origin_id=origin_id)
1799
+ options = _OriginBindOptions_088c2b51(
1800
+ origin_id=origin_id, distribution_id=distribution_id
1801
+ )
1257
1802
 
1258
1803
  return typing.cast(_OriginBindConfig_25a57096, jsii.invoke(self, "bind", [scope, options]))
1259
1804
 
@@ -1289,7 +1834,7 @@ class OriginGroupProps:
1289
1834
  cloudfront.Distribution(self, "myDist",
1290
1835
  default_behavior=cloudfront.BehaviorOptions(
1291
1836
  origin=origins.OriginGroup(
1292
- primary_origin=origins.S3Origin(my_bucket),
1837
+ primary_origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket),
1293
1838
  fallback_origin=origins.HttpOrigin("www.example.com"),
1294
1839
  # optional, defaults to: 500, 502, 503 and 504
1295
1840
  fallback_status_codes=[404]
@@ -1372,6 +1917,7 @@ class RestApiOrigin(
1372
1917
  connection_attempts: typing.Optional[jsii.Number] = None,
1373
1918
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1374
1919
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
1920
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1375
1921
  origin_id: typing.Optional[builtins.str] = None,
1376
1922
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1377
1923
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -1384,6 +1930,7 @@ class RestApiOrigin(
1384
1930
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
1385
1931
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
1386
1932
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
1933
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
1387
1934
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
1388
1935
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
1389
1936
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -1398,6 +1945,7 @@ class RestApiOrigin(
1398
1945
  connection_attempts=connection_attempts,
1399
1946
  connection_timeout=connection_timeout,
1400
1947
  custom_headers=custom_headers,
1948
+ origin_access_control_id=origin_access_control_id,
1401
1949
  origin_id=origin_id,
1402
1950
  origin_shield_enabled=origin_shield_enabled,
1403
1951
  origin_shield_region=origin_shield_region,
@@ -1419,6 +1967,7 @@ class RestApiOrigin(
1419
1967
  "connection_attempts": "connectionAttempts",
1420
1968
  "connection_timeout": "connectionTimeout",
1421
1969
  "custom_headers": "customHeaders",
1970
+ "origin_access_control_id": "originAccessControlId",
1422
1971
  "origin_id": "originId",
1423
1972
  "origin_shield_enabled": "originShieldEnabled",
1424
1973
  "origin_shield_region": "originShieldRegion",
@@ -1434,6 +1983,7 @@ class RestApiOriginProps(_OriginProps_0675928d):
1434
1983
  connection_attempts: typing.Optional[jsii.Number] = None,
1435
1984
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1436
1985
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
1986
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1437
1987
  origin_id: typing.Optional[builtins.str] = None,
1438
1988
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1439
1989
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -1446,6 +1996,7 @@ class RestApiOriginProps(_OriginProps_0675928d):
1446
1996
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
1447
1997
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
1448
1998
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
1999
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
1449
2000
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
1450
2001
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
1451
2002
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
@@ -1468,6 +2019,7 @@ class RestApiOriginProps(_OriginProps_0675928d):
1468
2019
  check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
1469
2020
  check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
1470
2021
  check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
2022
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
1471
2023
  check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
1472
2024
  check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
1473
2025
  check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
@@ -1481,6 +2033,8 @@ class RestApiOriginProps(_OriginProps_0675928d):
1481
2033
  self._values["connection_timeout"] = connection_timeout
1482
2034
  if custom_headers is not None:
1483
2035
  self._values["custom_headers"] = custom_headers
2036
+ if origin_access_control_id is not None:
2037
+ self._values["origin_access_control_id"] = origin_access_control_id
1484
2038
  if origin_id is not None:
1485
2039
  self._values["origin_id"] = origin_id
1486
2040
  if origin_shield_enabled is not None:
@@ -1527,6 +2081,15 @@ class RestApiOriginProps(_OriginProps_0675928d):
1527
2081
  result = self._values.get("custom_headers")
1528
2082
  return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
1529
2083
 
2084
+ @builtins.property
2085
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
2086
+ '''The unique identifier of an origin access control for this origin.
2087
+
2088
+ :default: - no origin access control
2089
+ '''
2090
+ result = self._values.get("origin_access_control_id")
2091
+ return typing.cast(typing.Optional[builtins.str], result)
2092
+
1530
2093
  @builtins.property
1531
2094
  def origin_id(self) -> typing.Optional[builtins.str]:
1532
2095
  '''A unique identifier for the origin.
@@ -1609,35 +2172,26 @@ class RestApiOriginProps(_OriginProps_0675928d):
1609
2172
  )
1610
2173
 
1611
2174
 
1612
- @jsii.implements(_IOrigin_83d4c1fa)
1613
- class S3Origin(
1614
- metaclass=jsii.JSIIMeta,
1615
- jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3Origin",
2175
+ class S3BucketOrigin(
2176
+ _OriginBase_b8fe5bcc,
2177
+ metaclass=jsii.JSIIAbstractClass,
2178
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3BucketOrigin",
1616
2179
  ):
1617
- '''An Origin that is backed by an S3 bucket.
1618
-
1619
- If the bucket is configured for website hosting, this origin will be configured to use the bucket as an
1620
- HTTP server origin and will use the bucket's configured website redirects and error handling. Otherwise,
1621
- the origin is created as a bucket origin and will use CloudFront's redirect and error handling.
2180
+ '''A S3 Bucket Origin.
1622
2181
 
1623
2182
  :exampleMetadata: infused
1624
2183
 
1625
2184
  Example::
1626
2185
 
1627
- # Adding an existing Lambda@Edge function created in a different stack
1628
- # to a CloudFront distribution.
1629
- # s3_bucket: s3.Bucket
1630
-
1631
- function_version = lambda_.Version.from_version_arn(self, "Version", "arn:aws:lambda:us-east-1:123456789012:function:functionName:1")
1632
-
1633
- cloudfront.Distribution(self, "distro",
2186
+ my_bucket = s3.Bucket(self, "myBucket")
2187
+ cloudfront.Distribution(self, "myDist",
1634
2188
  default_behavior=cloudfront.BehaviorOptions(
1635
- origin=origins.S3Origin(s3_bucket),
1636
- edge_lambdas=[cloudfront.EdgeLambda(
1637
- function_version=function_version,
1638
- event_type=cloudfront.LambdaEdgeEventType.VIEWER_REQUEST
2189
+ origin=origins.OriginGroup(
2190
+ primary_origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket),
2191
+ fallback_origin=origins.HttpOrigin("www.example.com"),
2192
+ # optional, defaults to: 500, 502, 503 and 504
2193
+ fallback_status_codes=[404]
1639
2194
  )
1640
- ]
1641
2195
  )
1642
2196
  )
1643
2197
  '''
@@ -1646,35 +2200,35 @@ class S3Origin(
1646
2200
  self,
1647
2201
  bucket: _IBucket_42e086fd,
1648
2202
  *,
1649
- origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
1650
2203
  origin_path: typing.Optional[builtins.str] = None,
1651
2204
  connection_attempts: typing.Optional[jsii.Number] = None,
1652
2205
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1653
2206
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
2207
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1654
2208
  origin_id: typing.Optional[builtins.str] = None,
1655
2209
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1656
2210
  origin_shield_region: typing.Optional[builtins.str] = None,
1657
2211
  ) -> None:
1658
2212
  '''
1659
2213
  :param bucket: -
1660
- :param origin_access_identity: An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket. Default: - An Origin Access Identity will be created.
1661
2214
  :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
1662
2215
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
1663
2216
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
1664
2217
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
2218
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
1665
2219
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
1666
2220
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
1667
2221
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
1668
2222
  '''
1669
2223
  if __debug__:
1670
- type_hints = typing.get_type_hints(_typecheckingstub__9ba8623373b0faa9ac55c816167da21a58e0753e0dd032b1f3e6ccd0bd977994)
2224
+ type_hints = typing.get_type_hints(_typecheckingstub__3cb1f0b82603224c7fbeb25b954355d9b19c8971c1f19cce6cc99b4579024f0f)
1671
2225
  check_type(argname="argument bucket", value=bucket, expected_type=type_hints["bucket"])
1672
- props = S3OriginProps(
1673
- origin_access_identity=origin_access_identity,
2226
+ props = S3BucketOriginBaseProps(
1674
2227
  origin_path=origin_path,
1675
2228
  connection_attempts=connection_attempts,
1676
2229
  connection_timeout=connection_timeout,
1677
2230
  custom_headers=custom_headers,
2231
+ origin_access_control_id=origin_access_control_id,
1678
2232
  origin_id=origin_id,
1679
2233
  origin_shield_enabled=origin_shield_enabled,
1680
2234
  origin_shield_region=origin_shield_region,
@@ -1682,87 +2236,1233 @@ class S3Origin(
1682
2236
 
1683
2237
  jsii.create(self.__class__, self, [bucket, props])
1684
2238
 
1685
- @jsii.member(jsii_name="bind")
1686
- def bind(
1687
- self,
1688
- scope: _constructs_77d1e7e8.Construct,
2239
+ @jsii.member(jsii_name="withBucketDefaults")
2240
+ @builtins.classmethod
2241
+ def with_bucket_defaults(
2242
+ cls,
2243
+ bucket: _IBucket_42e086fd,
1689
2244
  *,
1690
- origin_id: builtins.str,
1691
- ) -> _OriginBindConfig_25a57096:
1692
- '''The method called when a given Origin is added (for the first time) to a Distribution.
2245
+ origin_path: typing.Optional[builtins.str] = None,
2246
+ connection_attempts: typing.Optional[jsii.Number] = None,
2247
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2248
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
2249
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2250
+ origin_id: typing.Optional[builtins.str] = None,
2251
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
2252
+ origin_shield_region: typing.Optional[builtins.str] = None,
2253
+ ) -> _IOrigin_83d4c1fa:
2254
+ '''Create a S3 Origin with default S3 bucket settings (no origin access control).
1693
2255
 
1694
- :param scope: -
1695
- :param origin_id: The identifier of this Origin, as assigned by the Distribution this Origin has been used added to.
1696
- '''
1697
- if __debug__:
1698
- type_hints = typing.get_type_hints(_typecheckingstub__1731b0d7a385b196730b287be11e2cb13fa03d064ae3ffbfd55c5422a8f2c430)
1699
- check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
1700
- options = _OriginBindOptions_088c2b51(origin_id=origin_id)
2256
+ :param bucket: -
2257
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
2258
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
2259
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
2260
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
2261
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
2262
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
2263
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
2264
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
2265
+ '''
2266
+ if __debug__:
2267
+ type_hints = typing.get_type_hints(_typecheckingstub__f676436dc530972f0e77d574f148913989a94d38c9af09bff28450e29ace8acb)
2268
+ check_type(argname="argument bucket", value=bucket, expected_type=type_hints["bucket"])
2269
+ props = _OriginProps_0675928d(
2270
+ origin_path=origin_path,
2271
+ connection_attempts=connection_attempts,
2272
+ connection_timeout=connection_timeout,
2273
+ custom_headers=custom_headers,
2274
+ origin_access_control_id=origin_access_control_id,
2275
+ origin_id=origin_id,
2276
+ origin_shield_enabled=origin_shield_enabled,
2277
+ origin_shield_region=origin_shield_region,
2278
+ )
2279
+
2280
+ return typing.cast(_IOrigin_83d4c1fa, jsii.sinvoke(cls, "withBucketDefaults", [bucket, props]))
2281
+
2282
+ @jsii.member(jsii_name="withOriginAccessControl")
2283
+ @builtins.classmethod
2284
+ def with_origin_access_control(
2285
+ cls,
2286
+ bucket: _IBucket_42e086fd,
2287
+ *,
2288
+ origin_access_control: typing.Optional[_IOriginAccessControl_82a6fe5a] = None,
2289
+ origin_access_levels: typing.Optional[typing.Sequence[_AccessLevel_315d9a76]] = None,
2290
+ origin_path: typing.Optional[builtins.str] = None,
2291
+ connection_attempts: typing.Optional[jsii.Number] = None,
2292
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2293
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
2294
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2295
+ origin_id: typing.Optional[builtins.str] = None,
2296
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
2297
+ origin_shield_region: typing.Optional[builtins.str] = None,
2298
+ ) -> _IOrigin_83d4c1fa:
2299
+ '''Create a S3 Origin with Origin Access Control (OAC) configured.
2300
+
2301
+ :param bucket: -
2302
+ :param origin_access_control: An optional Origin Access Control. Default: - an Origin Access Control will be created.
2303
+ :param origin_access_levels: The level of permissions granted in the bucket policy and key policy (if applicable) to the CloudFront distribution. Default: [AccessLevel.READ]
2304
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
2305
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
2306
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
2307
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
2308
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
2309
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
2310
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
2311
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
2312
+ '''
2313
+ if __debug__:
2314
+ type_hints = typing.get_type_hints(_typecheckingstub__23afb965139dc34be23cec3ad5506b4c5de509db9c0d653bed7877f463b7a9db)
2315
+ check_type(argname="argument bucket", value=bucket, expected_type=type_hints["bucket"])
2316
+ props = S3BucketOriginWithOACProps(
2317
+ origin_access_control=origin_access_control,
2318
+ origin_access_levels=origin_access_levels,
2319
+ origin_path=origin_path,
2320
+ connection_attempts=connection_attempts,
2321
+ connection_timeout=connection_timeout,
2322
+ custom_headers=custom_headers,
2323
+ origin_access_control_id=origin_access_control_id,
2324
+ origin_id=origin_id,
2325
+ origin_shield_enabled=origin_shield_enabled,
2326
+ origin_shield_region=origin_shield_region,
2327
+ )
2328
+
2329
+ return typing.cast(_IOrigin_83d4c1fa, jsii.sinvoke(cls, "withOriginAccessControl", [bucket, props]))
2330
+
2331
+ @jsii.member(jsii_name="withOriginAccessIdentity")
2332
+ @builtins.classmethod
2333
+ def with_origin_access_identity(
2334
+ cls,
2335
+ bucket: _IBucket_42e086fd,
2336
+ *,
2337
+ origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
2338
+ origin_path: typing.Optional[builtins.str] = None,
2339
+ connection_attempts: typing.Optional[jsii.Number] = None,
2340
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2341
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
2342
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2343
+ origin_id: typing.Optional[builtins.str] = None,
2344
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
2345
+ origin_shield_region: typing.Optional[builtins.str] = None,
2346
+ ) -> _IOrigin_83d4c1fa:
2347
+ '''Create a S3 Origin with Origin Access Identity (OAI) configured OAI is a legacy feature and we **strongly** recommend you to use OAC via ``withOriginAccessControl()`` unless it is not supported in your required region (e.g. China regions).
2348
+
2349
+ :param bucket: -
2350
+ :param origin_access_identity: An optional Origin Access Identity. Default: - an Origin Access Identity will be created.
2351
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
2352
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
2353
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
2354
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
2355
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
2356
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
2357
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
2358
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
2359
+ '''
2360
+ if __debug__:
2361
+ type_hints = typing.get_type_hints(_typecheckingstub__13e7421c65d5fbb92fc686fa854daca3e90dc002f3e99da4b4757e32e3c4105d)
2362
+ check_type(argname="argument bucket", value=bucket, expected_type=type_hints["bucket"])
2363
+ props = S3BucketOriginWithOAIProps(
2364
+ origin_access_identity=origin_access_identity,
2365
+ origin_path=origin_path,
2366
+ connection_attempts=connection_attempts,
2367
+ connection_timeout=connection_timeout,
2368
+ custom_headers=custom_headers,
2369
+ origin_access_control_id=origin_access_control_id,
2370
+ origin_id=origin_id,
2371
+ origin_shield_enabled=origin_shield_enabled,
2372
+ origin_shield_region=origin_shield_region,
2373
+ )
2374
+
2375
+ return typing.cast(_IOrigin_83d4c1fa, jsii.sinvoke(cls, "withOriginAccessIdentity", [bucket, props]))
2376
+
2377
+ @jsii.member(jsii_name="renderS3OriginConfig")
2378
+ def _render_s3_origin_config(
2379
+ self,
2380
+ ) -> typing.Optional[_CfnDistribution_d9ad3595.S3OriginConfigProperty]:
2381
+ return typing.cast(typing.Optional[_CfnDistribution_d9ad3595.S3OriginConfigProperty], jsii.invoke(self, "renderS3OriginConfig", []))
1701
2382
 
1702
- return typing.cast(_OriginBindConfig_25a57096, jsii.invoke(self, "bind", [scope, options]))
2383
+
2384
+ class _S3BucketOriginProxy(
2385
+ S3BucketOrigin,
2386
+ jsii.proxy_for(_OriginBase_b8fe5bcc), # type: ignore[misc]
2387
+ ):
2388
+ pass
2389
+
2390
+ # Adding a "__jsii_proxy_class__(): typing.Type" function to the abstract class
2391
+ typing.cast(typing.Any, S3BucketOrigin).__jsii_proxy_class__ = lambda : _S3BucketOriginProxy
1703
2392
 
1704
2393
 
1705
2394
  @jsii.data_type(
1706
- jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3OriginProps",
2395
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3BucketOriginBaseProps",
1707
2396
  jsii_struct_bases=[_OriginProps_0675928d],
1708
2397
  name_mapping={
1709
2398
  "connection_attempts": "connectionAttempts",
1710
2399
  "connection_timeout": "connectionTimeout",
1711
2400
  "custom_headers": "customHeaders",
2401
+ "origin_access_control_id": "originAccessControlId",
1712
2402
  "origin_id": "originId",
1713
2403
  "origin_shield_enabled": "originShieldEnabled",
1714
2404
  "origin_shield_region": "originShieldRegion",
1715
2405
  "origin_path": "originPath",
1716
- "origin_access_identity": "originAccessIdentity",
1717
2406
  },
1718
2407
  )
1719
- class S3OriginProps(_OriginProps_0675928d):
2408
+ class S3BucketOriginBaseProps(_OriginProps_0675928d):
1720
2409
  def __init__(
1721
2410
  self,
1722
2411
  *,
1723
2412
  connection_attempts: typing.Optional[jsii.Number] = None,
1724
2413
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1725
2414
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
2415
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1726
2416
  origin_id: typing.Optional[builtins.str] = None,
1727
2417
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1728
2418
  origin_shield_region: typing.Optional[builtins.str] = None,
1729
2419
  origin_path: typing.Optional[builtins.str] = None,
1730
- origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
1731
2420
  ) -> None:
1732
- '''Properties to use to customize an S3 Origin.
2421
+ '''Properties for configuring a origin using a standard S3 bucket.
2422
+
2423
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
2424
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
2425
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
2426
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
2427
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
2428
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
2429
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
2430
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
2431
+
2432
+ :exampleMetadata: fixture=_generated
2433
+
2434
+ Example::
2435
+
2436
+ # The code below shows an example of how to instantiate this type.
2437
+ # The values are placeholders you should change.
2438
+ import aws_cdk as cdk
2439
+ from aws_cdk import aws_cloudfront_origins as cloudfront_origins
2440
+
2441
+ s3_bucket_origin_base_props = cloudfront_origins.S3BucketOriginBaseProps(
2442
+ connection_attempts=123,
2443
+ connection_timeout=cdk.Duration.minutes(30),
2444
+ custom_headers={
2445
+ "custom_headers_key": "customHeaders"
2446
+ },
2447
+ origin_access_control_id="originAccessControlId",
2448
+ origin_id="originId",
2449
+ origin_path="originPath",
2450
+ origin_shield_enabled=False,
2451
+ origin_shield_region="originShieldRegion"
2452
+ )
2453
+ '''
2454
+ if __debug__:
2455
+ type_hints = typing.get_type_hints(_typecheckingstub__c5e580c31fe629b713e1ecbf9905ebb4220e152805ab34129f693f2c4d4db098)
2456
+ check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
2457
+ check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
2458
+ check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
2459
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
2460
+ check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
2461
+ check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
2462
+ check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
2463
+ check_type(argname="argument origin_path", value=origin_path, expected_type=type_hints["origin_path"])
2464
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
2465
+ if connection_attempts is not None:
2466
+ self._values["connection_attempts"] = connection_attempts
2467
+ if connection_timeout is not None:
2468
+ self._values["connection_timeout"] = connection_timeout
2469
+ if custom_headers is not None:
2470
+ self._values["custom_headers"] = custom_headers
2471
+ if origin_access_control_id is not None:
2472
+ self._values["origin_access_control_id"] = origin_access_control_id
2473
+ if origin_id is not None:
2474
+ self._values["origin_id"] = origin_id
2475
+ if origin_shield_enabled is not None:
2476
+ self._values["origin_shield_enabled"] = origin_shield_enabled
2477
+ if origin_shield_region is not None:
2478
+ self._values["origin_shield_region"] = origin_shield_region
2479
+ if origin_path is not None:
2480
+ self._values["origin_path"] = origin_path
2481
+
2482
+ @builtins.property
2483
+ def connection_attempts(self) -> typing.Optional[jsii.Number]:
2484
+ '''The number of times that CloudFront attempts to connect to the origin;
2485
+
2486
+ valid values are 1, 2, or 3 attempts.
2487
+
2488
+ :default: 3
2489
+ '''
2490
+ result = self._values.get("connection_attempts")
2491
+ return typing.cast(typing.Optional[jsii.Number], result)
2492
+
2493
+ @builtins.property
2494
+ def connection_timeout(self) -> typing.Optional[_Duration_4839e8c3]:
2495
+ '''The number of seconds that CloudFront waits when trying to establish a connection to the origin.
2496
+
2497
+ Valid values are 1-10 seconds, inclusive.
2498
+
2499
+ :default: Duration.seconds(10)
2500
+ '''
2501
+ result = self._values.get("connection_timeout")
2502
+ return typing.cast(typing.Optional[_Duration_4839e8c3], result)
2503
+
2504
+ @builtins.property
2505
+ def custom_headers(
2506
+ self,
2507
+ ) -> typing.Optional[typing.Mapping[builtins.str, builtins.str]]:
2508
+ '''A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
2509
+
2510
+ :default: {}
2511
+ '''
2512
+ result = self._values.get("custom_headers")
2513
+ return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
2514
+
2515
+ @builtins.property
2516
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
2517
+ '''The unique identifier of an origin access control for this origin.
2518
+
2519
+ :default: - no origin access control
2520
+ '''
2521
+ result = self._values.get("origin_access_control_id")
2522
+ return typing.cast(typing.Optional[builtins.str], result)
2523
+
2524
+ @builtins.property
2525
+ def origin_id(self) -> typing.Optional[builtins.str]:
2526
+ '''A unique identifier for the origin.
2527
+
2528
+ This value must be unique within the distribution.
2529
+
2530
+ :default: - an originid will be generated for you
2531
+ '''
2532
+ result = self._values.get("origin_id")
2533
+ return typing.cast(typing.Optional[builtins.str], result)
2534
+
2535
+ @builtins.property
2536
+ def origin_shield_enabled(self) -> typing.Optional[builtins.bool]:
2537
+ '''Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false.
2538
+
2539
+ :default: - true
2540
+ '''
2541
+ result = self._values.get("origin_shield_enabled")
2542
+ return typing.cast(typing.Optional[builtins.bool], result)
2543
+
2544
+ @builtins.property
2545
+ def origin_shield_region(self) -> typing.Optional[builtins.str]:
2546
+ '''When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
2547
+
2548
+ :default: - origin shield not enabled
2549
+
2550
+ :see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
2551
+ '''
2552
+ result = self._values.get("origin_shield_region")
2553
+ return typing.cast(typing.Optional[builtins.str], result)
2554
+
2555
+ @builtins.property
2556
+ def origin_path(self) -> typing.Optional[builtins.str]:
2557
+ '''An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.
2558
+
2559
+ Must begin, but not end, with '/' (e.g., '/production/images').
2560
+
2561
+ :default: '/'
2562
+ '''
2563
+ result = self._values.get("origin_path")
2564
+ return typing.cast(typing.Optional[builtins.str], result)
2565
+
2566
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
2567
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
2568
+
2569
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
2570
+ return not (rhs == self)
2571
+
2572
+ def __repr__(self) -> str:
2573
+ return "S3BucketOriginBaseProps(%s)" % ", ".join(
2574
+ k + "=" + repr(v) for k, v in self._values.items()
2575
+ )
2576
+
2577
+
2578
+ @jsii.data_type(
2579
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3BucketOriginWithOACProps",
2580
+ jsii_struct_bases=[S3BucketOriginBaseProps],
2581
+ name_mapping={
2582
+ "connection_attempts": "connectionAttempts",
2583
+ "connection_timeout": "connectionTimeout",
2584
+ "custom_headers": "customHeaders",
2585
+ "origin_access_control_id": "originAccessControlId",
2586
+ "origin_id": "originId",
2587
+ "origin_shield_enabled": "originShieldEnabled",
2588
+ "origin_shield_region": "originShieldRegion",
2589
+ "origin_path": "originPath",
2590
+ "origin_access_control": "originAccessControl",
2591
+ "origin_access_levels": "originAccessLevels",
2592
+ },
2593
+ )
2594
+ class S3BucketOriginWithOACProps(S3BucketOriginBaseProps):
2595
+ def __init__(
2596
+ self,
2597
+ *,
2598
+ connection_attempts: typing.Optional[jsii.Number] = None,
2599
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2600
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
2601
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2602
+ origin_id: typing.Optional[builtins.str] = None,
2603
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
2604
+ origin_shield_region: typing.Optional[builtins.str] = None,
2605
+ origin_path: typing.Optional[builtins.str] = None,
2606
+ origin_access_control: typing.Optional[_IOriginAccessControl_82a6fe5a] = None,
2607
+ origin_access_levels: typing.Optional[typing.Sequence[_AccessLevel_315d9a76]] = None,
2608
+ ) -> None:
2609
+ '''Properties for configuring a S3 origin with OAC.
2610
+
2611
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
2612
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
2613
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
2614
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
2615
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
2616
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
2617
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
2618
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
2619
+ :param origin_access_control: An optional Origin Access Control. Default: - an Origin Access Control will be created.
2620
+ :param origin_access_levels: The level of permissions granted in the bucket policy and key policy (if applicable) to the CloudFront distribution. Default: [AccessLevel.READ]
2621
+
2622
+ :exampleMetadata: infused
2623
+
2624
+ Example::
2625
+
2626
+ my_bucket = s3.Bucket(self, "myBucket")
2627
+ s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
2628
+ origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.WRITE, cloudfront.AccessLevel.DELETE]
2629
+ )
2630
+ '''
2631
+ if __debug__:
2632
+ type_hints = typing.get_type_hints(_typecheckingstub__1af53a7ded1427e29cc874af45efdfe026a0004a1f2782a5bc936dbfcb4fe7a4)
2633
+ check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
2634
+ check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
2635
+ check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
2636
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
2637
+ check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
2638
+ check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
2639
+ check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
2640
+ check_type(argname="argument origin_path", value=origin_path, expected_type=type_hints["origin_path"])
2641
+ check_type(argname="argument origin_access_control", value=origin_access_control, expected_type=type_hints["origin_access_control"])
2642
+ check_type(argname="argument origin_access_levels", value=origin_access_levels, expected_type=type_hints["origin_access_levels"])
2643
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
2644
+ if connection_attempts is not None:
2645
+ self._values["connection_attempts"] = connection_attempts
2646
+ if connection_timeout is not None:
2647
+ self._values["connection_timeout"] = connection_timeout
2648
+ if custom_headers is not None:
2649
+ self._values["custom_headers"] = custom_headers
2650
+ if origin_access_control_id is not None:
2651
+ self._values["origin_access_control_id"] = origin_access_control_id
2652
+ if origin_id is not None:
2653
+ self._values["origin_id"] = origin_id
2654
+ if origin_shield_enabled is not None:
2655
+ self._values["origin_shield_enabled"] = origin_shield_enabled
2656
+ if origin_shield_region is not None:
2657
+ self._values["origin_shield_region"] = origin_shield_region
2658
+ if origin_path is not None:
2659
+ self._values["origin_path"] = origin_path
2660
+ if origin_access_control is not None:
2661
+ self._values["origin_access_control"] = origin_access_control
2662
+ if origin_access_levels is not None:
2663
+ self._values["origin_access_levels"] = origin_access_levels
2664
+
2665
+ @builtins.property
2666
+ def connection_attempts(self) -> typing.Optional[jsii.Number]:
2667
+ '''The number of times that CloudFront attempts to connect to the origin;
2668
+
2669
+ valid values are 1, 2, or 3 attempts.
2670
+
2671
+ :default: 3
2672
+ '''
2673
+ result = self._values.get("connection_attempts")
2674
+ return typing.cast(typing.Optional[jsii.Number], result)
2675
+
2676
+ @builtins.property
2677
+ def connection_timeout(self) -> typing.Optional[_Duration_4839e8c3]:
2678
+ '''The number of seconds that CloudFront waits when trying to establish a connection to the origin.
2679
+
2680
+ Valid values are 1-10 seconds, inclusive.
2681
+
2682
+ :default: Duration.seconds(10)
2683
+ '''
2684
+ result = self._values.get("connection_timeout")
2685
+ return typing.cast(typing.Optional[_Duration_4839e8c3], result)
2686
+
2687
+ @builtins.property
2688
+ def custom_headers(
2689
+ self,
2690
+ ) -> typing.Optional[typing.Mapping[builtins.str, builtins.str]]:
2691
+ '''A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
2692
+
2693
+ :default: {}
2694
+ '''
2695
+ result = self._values.get("custom_headers")
2696
+ return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
2697
+
2698
+ @builtins.property
2699
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
2700
+ '''The unique identifier of an origin access control for this origin.
2701
+
2702
+ :default: - no origin access control
2703
+ '''
2704
+ result = self._values.get("origin_access_control_id")
2705
+ return typing.cast(typing.Optional[builtins.str], result)
2706
+
2707
+ @builtins.property
2708
+ def origin_id(self) -> typing.Optional[builtins.str]:
2709
+ '''A unique identifier for the origin.
2710
+
2711
+ This value must be unique within the distribution.
2712
+
2713
+ :default: - an originid will be generated for you
2714
+ '''
2715
+ result = self._values.get("origin_id")
2716
+ return typing.cast(typing.Optional[builtins.str], result)
2717
+
2718
+ @builtins.property
2719
+ def origin_shield_enabled(self) -> typing.Optional[builtins.bool]:
2720
+ '''Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false.
2721
+
2722
+ :default: - true
2723
+ '''
2724
+ result = self._values.get("origin_shield_enabled")
2725
+ return typing.cast(typing.Optional[builtins.bool], result)
2726
+
2727
+ @builtins.property
2728
+ def origin_shield_region(self) -> typing.Optional[builtins.str]:
2729
+ '''When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
2730
+
2731
+ :default: - origin shield not enabled
2732
+
2733
+ :see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
2734
+ '''
2735
+ result = self._values.get("origin_shield_region")
2736
+ return typing.cast(typing.Optional[builtins.str], result)
2737
+
2738
+ @builtins.property
2739
+ def origin_path(self) -> typing.Optional[builtins.str]:
2740
+ '''An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.
2741
+
2742
+ Must begin, but not end, with '/' (e.g., '/production/images').
2743
+
2744
+ :default: '/'
2745
+ '''
2746
+ result = self._values.get("origin_path")
2747
+ return typing.cast(typing.Optional[builtins.str], result)
2748
+
2749
+ @builtins.property
2750
+ def origin_access_control(self) -> typing.Optional[_IOriginAccessControl_82a6fe5a]:
2751
+ '''An optional Origin Access Control.
2752
+
2753
+ :default: - an Origin Access Control will be created.
2754
+ '''
2755
+ result = self._values.get("origin_access_control")
2756
+ return typing.cast(typing.Optional[_IOriginAccessControl_82a6fe5a], result)
2757
+
2758
+ @builtins.property
2759
+ def origin_access_levels(
2760
+ self,
2761
+ ) -> typing.Optional[typing.List[_AccessLevel_315d9a76]]:
2762
+ '''The level of permissions granted in the bucket policy and key policy (if applicable) to the CloudFront distribution.
2763
+
2764
+ :default: [AccessLevel.READ]
2765
+ '''
2766
+ result = self._values.get("origin_access_levels")
2767
+ return typing.cast(typing.Optional[typing.List[_AccessLevel_315d9a76]], result)
2768
+
2769
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
2770
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
2771
+
2772
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
2773
+ return not (rhs == self)
2774
+
2775
+ def __repr__(self) -> str:
2776
+ return "S3BucketOriginWithOACProps(%s)" % ", ".join(
2777
+ k + "=" + repr(v) for k, v in self._values.items()
2778
+ )
2779
+
2780
+
2781
+ @jsii.data_type(
2782
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3BucketOriginWithOAIProps",
2783
+ jsii_struct_bases=[S3BucketOriginBaseProps],
2784
+ name_mapping={
2785
+ "connection_attempts": "connectionAttempts",
2786
+ "connection_timeout": "connectionTimeout",
2787
+ "custom_headers": "customHeaders",
2788
+ "origin_access_control_id": "originAccessControlId",
2789
+ "origin_id": "originId",
2790
+ "origin_shield_enabled": "originShieldEnabled",
2791
+ "origin_shield_region": "originShieldRegion",
2792
+ "origin_path": "originPath",
2793
+ "origin_access_identity": "originAccessIdentity",
2794
+ },
2795
+ )
2796
+ class S3BucketOriginWithOAIProps(S3BucketOriginBaseProps):
2797
+ def __init__(
2798
+ self,
2799
+ *,
2800
+ connection_attempts: typing.Optional[jsii.Number] = None,
2801
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2802
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
2803
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2804
+ origin_id: typing.Optional[builtins.str] = None,
2805
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
2806
+ origin_shield_region: typing.Optional[builtins.str] = None,
2807
+ origin_path: typing.Optional[builtins.str] = None,
2808
+ origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
2809
+ ) -> None:
2810
+ '''Properties for configuring a S3 origin with OAI.
2811
+
2812
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
2813
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
2814
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
2815
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
2816
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
2817
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
2818
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
2819
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
2820
+ :param origin_access_identity: An optional Origin Access Identity. Default: - an Origin Access Identity will be created.
2821
+
2822
+ :exampleMetadata: infused
2823
+
2824
+ Example::
2825
+
2826
+ my_bucket = s3.Bucket(self, "myBucket")
2827
+ my_oai = cloudfront.OriginAccessIdentity(self, "myOAI",
2828
+ comment="My custom OAI"
2829
+ )
2830
+ s3_origin = origins.S3BucketOrigin.with_origin_access_identity(my_bucket,
2831
+ origin_access_identity=my_oai
2832
+ )
2833
+ cloudfront.Distribution(self, "myDist",
2834
+ default_behavior=cloudfront.BehaviorOptions(
2835
+ origin=s3_origin
2836
+ )
2837
+ )
2838
+ '''
2839
+ if __debug__:
2840
+ type_hints = typing.get_type_hints(_typecheckingstub__4b64c18ef31b660c450eee84b6738d7bbd960797e1788e068be9663127832c26)
2841
+ check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
2842
+ check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
2843
+ check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
2844
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
2845
+ check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
2846
+ check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
2847
+ check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
2848
+ check_type(argname="argument origin_path", value=origin_path, expected_type=type_hints["origin_path"])
2849
+ check_type(argname="argument origin_access_identity", value=origin_access_identity, expected_type=type_hints["origin_access_identity"])
2850
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
2851
+ if connection_attempts is not None:
2852
+ self._values["connection_attempts"] = connection_attempts
2853
+ if connection_timeout is not None:
2854
+ self._values["connection_timeout"] = connection_timeout
2855
+ if custom_headers is not None:
2856
+ self._values["custom_headers"] = custom_headers
2857
+ if origin_access_control_id is not None:
2858
+ self._values["origin_access_control_id"] = origin_access_control_id
2859
+ if origin_id is not None:
2860
+ self._values["origin_id"] = origin_id
2861
+ if origin_shield_enabled is not None:
2862
+ self._values["origin_shield_enabled"] = origin_shield_enabled
2863
+ if origin_shield_region is not None:
2864
+ self._values["origin_shield_region"] = origin_shield_region
2865
+ if origin_path is not None:
2866
+ self._values["origin_path"] = origin_path
2867
+ if origin_access_identity is not None:
2868
+ self._values["origin_access_identity"] = origin_access_identity
2869
+
2870
+ @builtins.property
2871
+ def connection_attempts(self) -> typing.Optional[jsii.Number]:
2872
+ '''The number of times that CloudFront attempts to connect to the origin;
2873
+
2874
+ valid values are 1, 2, or 3 attempts.
2875
+
2876
+ :default: 3
2877
+ '''
2878
+ result = self._values.get("connection_attempts")
2879
+ return typing.cast(typing.Optional[jsii.Number], result)
2880
+
2881
+ @builtins.property
2882
+ def connection_timeout(self) -> typing.Optional[_Duration_4839e8c3]:
2883
+ '''The number of seconds that CloudFront waits when trying to establish a connection to the origin.
2884
+
2885
+ Valid values are 1-10 seconds, inclusive.
2886
+
2887
+ :default: Duration.seconds(10)
2888
+ '''
2889
+ result = self._values.get("connection_timeout")
2890
+ return typing.cast(typing.Optional[_Duration_4839e8c3], result)
2891
+
2892
+ @builtins.property
2893
+ def custom_headers(
2894
+ self,
2895
+ ) -> typing.Optional[typing.Mapping[builtins.str, builtins.str]]:
2896
+ '''A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
2897
+
2898
+ :default: {}
2899
+ '''
2900
+ result = self._values.get("custom_headers")
2901
+ return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
2902
+
2903
+ @builtins.property
2904
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
2905
+ '''The unique identifier of an origin access control for this origin.
2906
+
2907
+ :default: - no origin access control
2908
+ '''
2909
+ result = self._values.get("origin_access_control_id")
2910
+ return typing.cast(typing.Optional[builtins.str], result)
2911
+
2912
+ @builtins.property
2913
+ def origin_id(self) -> typing.Optional[builtins.str]:
2914
+ '''A unique identifier for the origin.
2915
+
2916
+ This value must be unique within the distribution.
2917
+
2918
+ :default: - an originid will be generated for you
2919
+ '''
2920
+ result = self._values.get("origin_id")
2921
+ return typing.cast(typing.Optional[builtins.str], result)
2922
+
2923
+ @builtins.property
2924
+ def origin_shield_enabled(self) -> typing.Optional[builtins.bool]:
2925
+ '''Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false.
2926
+
2927
+ :default: - true
2928
+ '''
2929
+ result = self._values.get("origin_shield_enabled")
2930
+ return typing.cast(typing.Optional[builtins.bool], result)
2931
+
2932
+ @builtins.property
2933
+ def origin_shield_region(self) -> typing.Optional[builtins.str]:
2934
+ '''When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
2935
+
2936
+ :default: - origin shield not enabled
2937
+
2938
+ :see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
2939
+ '''
2940
+ result = self._values.get("origin_shield_region")
2941
+ return typing.cast(typing.Optional[builtins.str], result)
2942
+
2943
+ @builtins.property
2944
+ def origin_path(self) -> typing.Optional[builtins.str]:
2945
+ '''An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.
2946
+
2947
+ Must begin, but not end, with '/' (e.g., '/production/images').
2948
+
2949
+ :default: '/'
2950
+ '''
2951
+ result = self._values.get("origin_path")
2952
+ return typing.cast(typing.Optional[builtins.str], result)
2953
+
2954
+ @builtins.property
2955
+ def origin_access_identity(
2956
+ self,
2957
+ ) -> typing.Optional[_IOriginAccessIdentity_a922494c]:
2958
+ '''An optional Origin Access Identity.
2959
+
2960
+ :default: - an Origin Access Identity will be created.
2961
+ '''
2962
+ result = self._values.get("origin_access_identity")
2963
+ return typing.cast(typing.Optional[_IOriginAccessIdentity_a922494c], result)
2964
+
2965
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
2966
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
2967
+
2968
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
2969
+ return not (rhs == self)
2970
+
2971
+ def __repr__(self) -> str:
2972
+ return "S3BucketOriginWithOAIProps(%s)" % ", ".join(
2973
+ k + "=" + repr(v) for k, v in self._values.items()
2974
+ )
2975
+
2976
+
2977
+ @jsii.implements(_IOrigin_83d4c1fa)
2978
+ class S3Origin(
2979
+ metaclass=jsii.JSIIMeta,
2980
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3Origin",
2981
+ ):
2982
+ '''(deprecated) An Origin that is backed by an S3 bucket.
2983
+
2984
+ If the bucket is configured for website hosting, this origin will be configured to use the bucket as an
2985
+ HTTP server origin and will use the bucket's configured website redirects and error handling. Otherwise,
2986
+ the origin is created as a bucket origin and will use CloudFront's redirect and error handling.
2987
+
2988
+ :deprecated: Use ``S3BucketOrigin`` or ``S3StaticWebsiteOrigin`` instead.
2989
+
2990
+ :stability: deprecated
2991
+ :exampleMetadata: infused
2992
+
2993
+ Example::
2994
+
2995
+ # Adding an existing Lambda@Edge function created in a different stack
2996
+ # to a CloudFront distribution.
2997
+ # s3_bucket: s3.Bucket
2998
+
2999
+ function_version = lambda_.Version.from_version_arn(self, "Version", "arn:aws:lambda:us-east-1:123456789012:function:functionName:1")
3000
+
3001
+ cloudfront.Distribution(self, "distro",
3002
+ default_behavior=cloudfront.BehaviorOptions(
3003
+ origin=origins.S3Origin(s3_bucket),
3004
+ edge_lambdas=[cloudfront.EdgeLambda(
3005
+ function_version=function_version,
3006
+ event_type=cloudfront.LambdaEdgeEventType.VIEWER_REQUEST
3007
+ )
3008
+ ]
3009
+ )
3010
+ )
3011
+ '''
3012
+
3013
+ def __init__(
3014
+ self,
3015
+ bucket: _IBucket_42e086fd,
3016
+ *,
3017
+ origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
3018
+ origin_path: typing.Optional[builtins.str] = None,
3019
+ connection_attempts: typing.Optional[jsii.Number] = None,
3020
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3021
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3022
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3023
+ origin_id: typing.Optional[builtins.str] = None,
3024
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3025
+ origin_shield_region: typing.Optional[builtins.str] = None,
3026
+ ) -> None:
3027
+ '''
3028
+ :param bucket: -
3029
+ :param origin_access_identity: An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket. Default: - An Origin Access Identity will be created.
3030
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
3031
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
3032
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
3033
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
3034
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
3035
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
3036
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
3037
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
3038
+
3039
+ :stability: deprecated
3040
+ '''
3041
+ if __debug__:
3042
+ type_hints = typing.get_type_hints(_typecheckingstub__9ba8623373b0faa9ac55c816167da21a58e0753e0dd032b1f3e6ccd0bd977994)
3043
+ check_type(argname="argument bucket", value=bucket, expected_type=type_hints["bucket"])
3044
+ props = S3OriginProps(
3045
+ origin_access_identity=origin_access_identity,
3046
+ origin_path=origin_path,
3047
+ connection_attempts=connection_attempts,
3048
+ connection_timeout=connection_timeout,
3049
+ custom_headers=custom_headers,
3050
+ origin_access_control_id=origin_access_control_id,
3051
+ origin_id=origin_id,
3052
+ origin_shield_enabled=origin_shield_enabled,
3053
+ origin_shield_region=origin_shield_region,
3054
+ )
3055
+
3056
+ jsii.create(self.__class__, self, [bucket, props])
3057
+
3058
+ @jsii.member(jsii_name="bind")
3059
+ def bind(
3060
+ self,
3061
+ scope: _constructs_77d1e7e8.Construct,
3062
+ *,
3063
+ origin_id: builtins.str,
3064
+ distribution_id: typing.Optional[builtins.str] = None,
3065
+ ) -> _OriginBindConfig_25a57096:
3066
+ '''(deprecated) The method called when a given Origin is added (for the first time) to a Distribution.
3067
+
3068
+ :param scope: -
3069
+ :param origin_id: The identifier of this Origin, as assigned by the Distribution this Origin has been used added to.
3070
+ :param distribution_id: The identifier of the Distribution this Origin is used for. This is used to grant origin access permissions to the distribution for origin access control. Default: - no distribution id
3071
+
3072
+ :stability: deprecated
3073
+ '''
3074
+ if __debug__:
3075
+ type_hints = typing.get_type_hints(_typecheckingstub__1731b0d7a385b196730b287be11e2cb13fa03d064ae3ffbfd55c5422a8f2c430)
3076
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
3077
+ options = _OriginBindOptions_088c2b51(
3078
+ origin_id=origin_id, distribution_id=distribution_id
3079
+ )
3080
+
3081
+ return typing.cast(_OriginBindConfig_25a57096, jsii.invoke(self, "bind", [scope, options]))
3082
+
3083
+
3084
+ @jsii.data_type(
3085
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3OriginProps",
3086
+ jsii_struct_bases=[_OriginProps_0675928d],
3087
+ name_mapping={
3088
+ "connection_attempts": "connectionAttempts",
3089
+ "connection_timeout": "connectionTimeout",
3090
+ "custom_headers": "customHeaders",
3091
+ "origin_access_control_id": "originAccessControlId",
3092
+ "origin_id": "originId",
3093
+ "origin_shield_enabled": "originShieldEnabled",
3094
+ "origin_shield_region": "originShieldRegion",
3095
+ "origin_path": "originPath",
3096
+ "origin_access_identity": "originAccessIdentity",
3097
+ },
3098
+ )
3099
+ class S3OriginProps(_OriginProps_0675928d):
3100
+ def __init__(
3101
+ self,
3102
+ *,
3103
+ connection_attempts: typing.Optional[jsii.Number] = None,
3104
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3105
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3106
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3107
+ origin_id: typing.Optional[builtins.str] = None,
3108
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3109
+ origin_shield_region: typing.Optional[builtins.str] = None,
3110
+ origin_path: typing.Optional[builtins.str] = None,
3111
+ origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
3112
+ ) -> None:
3113
+ '''Properties to use to customize an S3 Origin.
3114
+
3115
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
3116
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
3117
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
3118
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
3119
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
3120
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
3121
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
3122
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
3123
+ :param origin_access_identity: An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket. Default: - An Origin Access Identity will be created.
3124
+
3125
+ :exampleMetadata: fixture=_generated
3126
+
3127
+ Example::
3128
+
3129
+ # The code below shows an example of how to instantiate this type.
3130
+ # The values are placeholders you should change.
3131
+ import aws_cdk as cdk
3132
+ from aws_cdk import aws_cloudfront as cloudfront
3133
+ from aws_cdk import aws_cloudfront_origins as cloudfront_origins
3134
+
3135
+ # origin_access_identity: cloudfront.OriginAccessIdentity
3136
+
3137
+ s3_origin_props = cloudfront_origins.S3OriginProps(
3138
+ connection_attempts=123,
3139
+ connection_timeout=cdk.Duration.minutes(30),
3140
+ custom_headers={
3141
+ "custom_headers_key": "customHeaders"
3142
+ },
3143
+ origin_access_control_id="originAccessControlId",
3144
+ origin_access_identity=origin_access_identity,
3145
+ origin_id="originId",
3146
+ origin_path="originPath",
3147
+ origin_shield_enabled=False,
3148
+ origin_shield_region="originShieldRegion"
3149
+ )
3150
+ '''
3151
+ if __debug__:
3152
+ type_hints = typing.get_type_hints(_typecheckingstub__bbd2a0ca1bf4d32899d90ea633e3ac416a6fa29972ee055a5866ec269b24307e)
3153
+ check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
3154
+ check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
3155
+ check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
3156
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
3157
+ check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
3158
+ check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
3159
+ check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
3160
+ check_type(argname="argument origin_path", value=origin_path, expected_type=type_hints["origin_path"])
3161
+ check_type(argname="argument origin_access_identity", value=origin_access_identity, expected_type=type_hints["origin_access_identity"])
3162
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
3163
+ if connection_attempts is not None:
3164
+ self._values["connection_attempts"] = connection_attempts
3165
+ if connection_timeout is not None:
3166
+ self._values["connection_timeout"] = connection_timeout
3167
+ if custom_headers is not None:
3168
+ self._values["custom_headers"] = custom_headers
3169
+ if origin_access_control_id is not None:
3170
+ self._values["origin_access_control_id"] = origin_access_control_id
3171
+ if origin_id is not None:
3172
+ self._values["origin_id"] = origin_id
3173
+ if origin_shield_enabled is not None:
3174
+ self._values["origin_shield_enabled"] = origin_shield_enabled
3175
+ if origin_shield_region is not None:
3176
+ self._values["origin_shield_region"] = origin_shield_region
3177
+ if origin_path is not None:
3178
+ self._values["origin_path"] = origin_path
3179
+ if origin_access_identity is not None:
3180
+ self._values["origin_access_identity"] = origin_access_identity
3181
+
3182
+ @builtins.property
3183
+ def connection_attempts(self) -> typing.Optional[jsii.Number]:
3184
+ '''The number of times that CloudFront attempts to connect to the origin;
3185
+
3186
+ valid values are 1, 2, or 3 attempts.
3187
+
3188
+ :default: 3
3189
+ '''
3190
+ result = self._values.get("connection_attempts")
3191
+ return typing.cast(typing.Optional[jsii.Number], result)
3192
+
3193
+ @builtins.property
3194
+ def connection_timeout(self) -> typing.Optional[_Duration_4839e8c3]:
3195
+ '''The number of seconds that CloudFront waits when trying to establish a connection to the origin.
3196
+
3197
+ Valid values are 1-10 seconds, inclusive.
3198
+
3199
+ :default: Duration.seconds(10)
3200
+ '''
3201
+ result = self._values.get("connection_timeout")
3202
+ return typing.cast(typing.Optional[_Duration_4839e8c3], result)
3203
+
3204
+ @builtins.property
3205
+ def custom_headers(
3206
+ self,
3207
+ ) -> typing.Optional[typing.Mapping[builtins.str, builtins.str]]:
3208
+ '''A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
3209
+
3210
+ :default: {}
3211
+ '''
3212
+ result = self._values.get("custom_headers")
3213
+ return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
3214
+
3215
+ @builtins.property
3216
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
3217
+ '''The unique identifier of an origin access control for this origin.
3218
+
3219
+ :default: - no origin access control
3220
+ '''
3221
+ result = self._values.get("origin_access_control_id")
3222
+ return typing.cast(typing.Optional[builtins.str], result)
3223
+
3224
+ @builtins.property
3225
+ def origin_id(self) -> typing.Optional[builtins.str]:
3226
+ '''A unique identifier for the origin.
3227
+
3228
+ This value must be unique within the distribution.
3229
+
3230
+ :default: - an originid will be generated for you
3231
+ '''
3232
+ result = self._values.get("origin_id")
3233
+ return typing.cast(typing.Optional[builtins.str], result)
3234
+
3235
+ @builtins.property
3236
+ def origin_shield_enabled(self) -> typing.Optional[builtins.bool]:
3237
+ '''Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false.
3238
+
3239
+ :default: - true
3240
+ '''
3241
+ result = self._values.get("origin_shield_enabled")
3242
+ return typing.cast(typing.Optional[builtins.bool], result)
3243
+
3244
+ @builtins.property
3245
+ def origin_shield_region(self) -> typing.Optional[builtins.str]:
3246
+ '''When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
3247
+
3248
+ :default: - origin shield not enabled
3249
+
3250
+ :see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
3251
+ '''
3252
+ result = self._values.get("origin_shield_region")
3253
+ return typing.cast(typing.Optional[builtins.str], result)
3254
+
3255
+ @builtins.property
3256
+ def origin_path(self) -> typing.Optional[builtins.str]:
3257
+ '''An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.
3258
+
3259
+ Must begin, but not end, with '/' (e.g., '/production/images').
3260
+
3261
+ :default: '/'
3262
+ '''
3263
+ result = self._values.get("origin_path")
3264
+ return typing.cast(typing.Optional[builtins.str], result)
3265
+
3266
+ @builtins.property
3267
+ def origin_access_identity(
3268
+ self,
3269
+ ) -> typing.Optional[_IOriginAccessIdentity_a922494c]:
3270
+ '''An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket.
3271
+
3272
+ :default: - An Origin Access Identity will be created.
3273
+ '''
3274
+ result = self._values.get("origin_access_identity")
3275
+ return typing.cast(typing.Optional[_IOriginAccessIdentity_a922494c], result)
3276
+
3277
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
3278
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
3279
+
3280
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
3281
+ return not (rhs == self)
3282
+
3283
+ def __repr__(self) -> str:
3284
+ return "S3OriginProps(%s)" % ", ".join(
3285
+ k + "=" + repr(v) for k, v in self._values.items()
3286
+ )
3287
+
3288
+
3289
+ class S3StaticWebsiteOrigin(
3290
+ HttpOrigin,
3291
+ metaclass=jsii.JSIIMeta,
3292
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3StaticWebsiteOrigin",
3293
+ ):
3294
+ '''An Origin for a S3 bucket configured as a website endpoint.
3295
+
3296
+ :exampleMetadata: infused
3297
+
3298
+ Example::
3299
+
3300
+ my_bucket = s3.Bucket(self, "myBucket")
3301
+ cloudfront.Distribution(self, "myDist",
3302
+ default_behavior=cloudfront.BehaviorOptions(origin=origins.S3StaticWebsiteOrigin(my_bucket))
3303
+ )
3304
+ '''
3305
+
3306
+ def __init__(
3307
+ self,
3308
+ bucket: _IBucket_42e086fd,
3309
+ *,
3310
+ http_port: typing.Optional[jsii.Number] = None,
3311
+ https_port: typing.Optional[jsii.Number] = None,
3312
+ keepalive_timeout: typing.Optional[_Duration_4839e8c3] = None,
3313
+ origin_ssl_protocols: typing.Optional[typing.Sequence[_OriginSslPolicy_d65cede2]] = None,
3314
+ protocol_policy: typing.Optional[_OriginProtocolPolicy_967ed73c] = None,
3315
+ read_timeout: typing.Optional[_Duration_4839e8c3] = None,
3316
+ origin_path: typing.Optional[builtins.str] = None,
3317
+ connection_attempts: typing.Optional[jsii.Number] = None,
3318
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3319
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3320
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3321
+ origin_id: typing.Optional[builtins.str] = None,
3322
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3323
+ origin_shield_region: typing.Optional[builtins.str] = None,
3324
+ ) -> None:
3325
+ '''
3326
+ :param bucket: -
3327
+ :param http_port: The HTTP port that CloudFront uses to connect to the origin. Default: 80
3328
+ :param https_port: The HTTPS port that CloudFront uses to connect to the origin. Default: 443
3329
+ :param keepalive_timeout: Specifies how long, in seconds, CloudFront persists its connection to the origin. The valid range is from 1 to 180 seconds, inclusive. Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Default: Duration.seconds(5)
3330
+ :param origin_ssl_protocols: The SSL versions to use when interacting with the origin. Default: OriginSslPolicy.TLS_V1_2
3331
+ :param protocol_policy: Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Default: OriginProtocolPolicy.HTTPS_ONLY
3332
+ :param read_timeout: Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout. The valid range is from 1 to 180 seconds, inclusive. Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Default: Duration.seconds(30)
3333
+ :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
3334
+ :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
3335
+ :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
3336
+ :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
3337
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
3338
+ :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
3339
+ :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
3340
+ :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
3341
+ '''
3342
+ if __debug__:
3343
+ type_hints = typing.get_type_hints(_typecheckingstub__f0edd2083352b96faf3ea9eb05136629dff841fa272ecdb6dfb52772a77b9b22)
3344
+ check_type(argname="argument bucket", value=bucket, expected_type=type_hints["bucket"])
3345
+ props = S3StaticWebsiteOriginProps(
3346
+ http_port=http_port,
3347
+ https_port=https_port,
3348
+ keepalive_timeout=keepalive_timeout,
3349
+ origin_ssl_protocols=origin_ssl_protocols,
3350
+ protocol_policy=protocol_policy,
3351
+ read_timeout=read_timeout,
3352
+ origin_path=origin_path,
3353
+ connection_attempts=connection_attempts,
3354
+ connection_timeout=connection_timeout,
3355
+ custom_headers=custom_headers,
3356
+ origin_access_control_id=origin_access_control_id,
3357
+ origin_id=origin_id,
3358
+ origin_shield_enabled=origin_shield_enabled,
3359
+ origin_shield_region=origin_shield_region,
3360
+ )
3361
+
3362
+ jsii.create(self.__class__, self, [bucket, props])
3363
+
3364
+
3365
+ @jsii.data_type(
3366
+ jsii_type="aws-cdk-lib.aws_cloudfront_origins.S3StaticWebsiteOriginProps",
3367
+ jsii_struct_bases=[HttpOriginProps],
3368
+ name_mapping={
3369
+ "connection_attempts": "connectionAttempts",
3370
+ "connection_timeout": "connectionTimeout",
3371
+ "custom_headers": "customHeaders",
3372
+ "origin_access_control_id": "originAccessControlId",
3373
+ "origin_id": "originId",
3374
+ "origin_shield_enabled": "originShieldEnabled",
3375
+ "origin_shield_region": "originShieldRegion",
3376
+ "origin_path": "originPath",
3377
+ "http_port": "httpPort",
3378
+ "https_port": "httpsPort",
3379
+ "keepalive_timeout": "keepaliveTimeout",
3380
+ "origin_ssl_protocols": "originSslProtocols",
3381
+ "protocol_policy": "protocolPolicy",
3382
+ "read_timeout": "readTimeout",
3383
+ },
3384
+ )
3385
+ class S3StaticWebsiteOriginProps(HttpOriginProps):
3386
+ def __init__(
3387
+ self,
3388
+ *,
3389
+ connection_attempts: typing.Optional[jsii.Number] = None,
3390
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3391
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3392
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3393
+ origin_id: typing.Optional[builtins.str] = None,
3394
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3395
+ origin_shield_region: typing.Optional[builtins.str] = None,
3396
+ origin_path: typing.Optional[builtins.str] = None,
3397
+ http_port: typing.Optional[jsii.Number] = None,
3398
+ https_port: typing.Optional[jsii.Number] = None,
3399
+ keepalive_timeout: typing.Optional[_Duration_4839e8c3] = None,
3400
+ origin_ssl_protocols: typing.Optional[typing.Sequence[_OriginSslPolicy_d65cede2]] = None,
3401
+ protocol_policy: typing.Optional[_OriginProtocolPolicy_967ed73c] = None,
3402
+ read_timeout: typing.Optional[_Duration_4839e8c3] = None,
3403
+ ) -> None:
3404
+ '''Properties for configuring a origin using a S3 bucket configured as a website endpoint.
1733
3405
 
1734
3406
  :param connection_attempts: The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3
1735
3407
  :param connection_timeout: The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)
1736
3408
  :param custom_headers: A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. Default: {}
3409
+ :param origin_access_control_id: The unique identifier of an origin access control for this origin. Default: - no origin access control
1737
3410
  :param origin_id: A unique identifier for the origin. This value must be unique within the distribution. Default: - an originid will be generated for you
1738
3411
  :param origin_shield_enabled: Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false. Default: - true
1739
3412
  :param origin_shield_region: When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled
1740
3413
  :param origin_path: An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. Must begin, but not end, with '/' (e.g., '/production/images'). Default: '/'
1741
- :param origin_access_identity: An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket. Default: - An Origin Access Identity will be created.
3414
+ :param http_port: The HTTP port that CloudFront uses to connect to the origin. Default: 80
3415
+ :param https_port: The HTTPS port that CloudFront uses to connect to the origin. Default: 443
3416
+ :param keepalive_timeout: Specifies how long, in seconds, CloudFront persists its connection to the origin. The valid range is from 1 to 180 seconds, inclusive. Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Default: Duration.seconds(5)
3417
+ :param origin_ssl_protocols: The SSL versions to use when interacting with the origin. Default: OriginSslPolicy.TLS_V1_2
3418
+ :param protocol_policy: Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Default: OriginProtocolPolicy.HTTPS_ONLY
3419
+ :param read_timeout: Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout. The valid range is from 1 to 180 seconds, inclusive. Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Default: Duration.seconds(30)
1742
3420
 
1743
- :exampleMetadata: infused
3421
+ :exampleMetadata: fixture=_generated
1744
3422
 
1745
3423
  Example::
1746
3424
 
1747
- my_bucket = s3.Bucket(self, "myBucket")
1748
- cloudfront.Distribution(self, "myDist",
1749
- default_behavior=cloudfront.BehaviorOptions(origin=origins.S3Origin(my_bucket,
1750
- custom_headers={
1751
- "Foo": "bar"
1752
- }
1753
- ))
3425
+ # The code below shows an example of how to instantiate this type.
3426
+ # The values are placeholders you should change.
3427
+ import aws_cdk as cdk
3428
+ from aws_cdk import aws_cloudfront as cloudfront
3429
+ from aws_cdk import aws_cloudfront_origins as cloudfront_origins
3430
+
3431
+ s3_static_website_origin_props = cloudfront_origins.S3StaticWebsiteOriginProps(
3432
+ connection_attempts=123,
3433
+ connection_timeout=cdk.Duration.minutes(30),
3434
+ custom_headers={
3435
+ "custom_headers_key": "customHeaders"
3436
+ },
3437
+ http_port=123,
3438
+ https_port=123,
3439
+ keepalive_timeout=cdk.Duration.minutes(30),
3440
+ origin_access_control_id="originAccessControlId",
3441
+ origin_id="originId",
3442
+ origin_path="originPath",
3443
+ origin_shield_enabled=False,
3444
+ origin_shield_region="originShieldRegion",
3445
+ origin_ssl_protocols=[cloudfront.OriginSslPolicy.SSL_V3],
3446
+ protocol_policy=cloudfront.OriginProtocolPolicy.HTTP_ONLY,
3447
+ read_timeout=cdk.Duration.minutes(30)
1754
3448
  )
1755
3449
  '''
1756
3450
  if __debug__:
1757
- type_hints = typing.get_type_hints(_typecheckingstub__bbd2a0ca1bf4d32899d90ea633e3ac416a6fa29972ee055a5866ec269b24307e)
3451
+ type_hints = typing.get_type_hints(_typecheckingstub__5bc18cdba7c0e6d7d0a68d2a1cf3c3f91f50a7e3e7384f5f62ebee6006adbb85)
1758
3452
  check_type(argname="argument connection_attempts", value=connection_attempts, expected_type=type_hints["connection_attempts"])
1759
3453
  check_type(argname="argument connection_timeout", value=connection_timeout, expected_type=type_hints["connection_timeout"])
1760
3454
  check_type(argname="argument custom_headers", value=custom_headers, expected_type=type_hints["custom_headers"])
3455
+ check_type(argname="argument origin_access_control_id", value=origin_access_control_id, expected_type=type_hints["origin_access_control_id"])
1761
3456
  check_type(argname="argument origin_id", value=origin_id, expected_type=type_hints["origin_id"])
1762
3457
  check_type(argname="argument origin_shield_enabled", value=origin_shield_enabled, expected_type=type_hints["origin_shield_enabled"])
1763
3458
  check_type(argname="argument origin_shield_region", value=origin_shield_region, expected_type=type_hints["origin_shield_region"])
1764
3459
  check_type(argname="argument origin_path", value=origin_path, expected_type=type_hints["origin_path"])
1765
- check_type(argname="argument origin_access_identity", value=origin_access_identity, expected_type=type_hints["origin_access_identity"])
3460
+ check_type(argname="argument http_port", value=http_port, expected_type=type_hints["http_port"])
3461
+ check_type(argname="argument https_port", value=https_port, expected_type=type_hints["https_port"])
3462
+ check_type(argname="argument keepalive_timeout", value=keepalive_timeout, expected_type=type_hints["keepalive_timeout"])
3463
+ check_type(argname="argument origin_ssl_protocols", value=origin_ssl_protocols, expected_type=type_hints["origin_ssl_protocols"])
3464
+ check_type(argname="argument protocol_policy", value=protocol_policy, expected_type=type_hints["protocol_policy"])
3465
+ check_type(argname="argument read_timeout", value=read_timeout, expected_type=type_hints["read_timeout"])
1766
3466
  self._values: typing.Dict[builtins.str, typing.Any] = {}
1767
3467
  if connection_attempts is not None:
1768
3468
  self._values["connection_attempts"] = connection_attempts
@@ -1770,6 +3470,8 @@ class S3OriginProps(_OriginProps_0675928d):
1770
3470
  self._values["connection_timeout"] = connection_timeout
1771
3471
  if custom_headers is not None:
1772
3472
  self._values["custom_headers"] = custom_headers
3473
+ if origin_access_control_id is not None:
3474
+ self._values["origin_access_control_id"] = origin_access_control_id
1773
3475
  if origin_id is not None:
1774
3476
  self._values["origin_id"] = origin_id
1775
3477
  if origin_shield_enabled is not None:
@@ -1778,8 +3480,18 @@ class S3OriginProps(_OriginProps_0675928d):
1778
3480
  self._values["origin_shield_region"] = origin_shield_region
1779
3481
  if origin_path is not None:
1780
3482
  self._values["origin_path"] = origin_path
1781
- if origin_access_identity is not None:
1782
- self._values["origin_access_identity"] = origin_access_identity
3483
+ if http_port is not None:
3484
+ self._values["http_port"] = http_port
3485
+ if https_port is not None:
3486
+ self._values["https_port"] = https_port
3487
+ if keepalive_timeout is not None:
3488
+ self._values["keepalive_timeout"] = keepalive_timeout
3489
+ if origin_ssl_protocols is not None:
3490
+ self._values["origin_ssl_protocols"] = origin_ssl_protocols
3491
+ if protocol_policy is not None:
3492
+ self._values["protocol_policy"] = protocol_policy
3493
+ if read_timeout is not None:
3494
+ self._values["read_timeout"] = read_timeout
1783
3495
 
1784
3496
  @builtins.property
1785
3497
  def connection_attempts(self) -> typing.Optional[jsii.Number]:
@@ -1814,6 +3526,15 @@ class S3OriginProps(_OriginProps_0675928d):
1814
3526
  result = self._values.get("custom_headers")
1815
3527
  return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
1816
3528
 
3529
+ @builtins.property
3530
+ def origin_access_control_id(self) -> typing.Optional[builtins.str]:
3531
+ '''The unique identifier of an origin access control for this origin.
3532
+
3533
+ :default: - no origin access control
3534
+ '''
3535
+ result = self._values.get("origin_access_control_id")
3536
+ return typing.cast(typing.Optional[builtins.str], result)
3537
+
1817
3538
  @builtins.property
1818
3539
  def origin_id(self) -> typing.Optional[builtins.str]:
1819
3540
  '''A unique identifier for the origin.
@@ -1857,15 +3578,70 @@ class S3OriginProps(_OriginProps_0675928d):
1857
3578
  return typing.cast(typing.Optional[builtins.str], result)
1858
3579
 
1859
3580
  @builtins.property
1860
- def origin_access_identity(
3581
+ def http_port(self) -> typing.Optional[jsii.Number]:
3582
+ '''The HTTP port that CloudFront uses to connect to the origin.
3583
+
3584
+ :default: 80
3585
+ '''
3586
+ result = self._values.get("http_port")
3587
+ return typing.cast(typing.Optional[jsii.Number], result)
3588
+
3589
+ @builtins.property
3590
+ def https_port(self) -> typing.Optional[jsii.Number]:
3591
+ '''The HTTPS port that CloudFront uses to connect to the origin.
3592
+
3593
+ :default: 443
3594
+ '''
3595
+ result = self._values.get("https_port")
3596
+ return typing.cast(typing.Optional[jsii.Number], result)
3597
+
3598
+ @builtins.property
3599
+ def keepalive_timeout(self) -> typing.Optional[_Duration_4839e8c3]:
3600
+ '''Specifies how long, in seconds, CloudFront persists its connection to the origin.
3601
+
3602
+ The valid range is from 1 to 180 seconds, inclusive.
3603
+
3604
+ Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota
3605
+ has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time.
3606
+
3607
+ :default: Duration.seconds(5)
3608
+ '''
3609
+ result = self._values.get("keepalive_timeout")
3610
+ return typing.cast(typing.Optional[_Duration_4839e8c3], result)
3611
+
3612
+ @builtins.property
3613
+ def origin_ssl_protocols(
1861
3614
  self,
1862
- ) -> typing.Optional[_IOriginAccessIdentity_a922494c]:
1863
- '''An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket.
3615
+ ) -> typing.Optional[typing.List[_OriginSslPolicy_d65cede2]]:
3616
+ '''The SSL versions to use when interacting with the origin.
1864
3617
 
1865
- :default: - An Origin Access Identity will be created.
3618
+ :default: OriginSslPolicy.TLS_V1_2
1866
3619
  '''
1867
- result = self._values.get("origin_access_identity")
1868
- return typing.cast(typing.Optional[_IOriginAccessIdentity_a922494c], result)
3620
+ result = self._values.get("origin_ssl_protocols")
3621
+ return typing.cast(typing.Optional[typing.List[_OriginSslPolicy_d65cede2]], result)
3622
+
3623
+ @builtins.property
3624
+ def protocol_policy(self) -> typing.Optional[_OriginProtocolPolicy_967ed73c]:
3625
+ '''Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin.
3626
+
3627
+ :default: OriginProtocolPolicy.HTTPS_ONLY
3628
+ '''
3629
+ result = self._values.get("protocol_policy")
3630
+ return typing.cast(typing.Optional[_OriginProtocolPolicy_967ed73c], result)
3631
+
3632
+ @builtins.property
3633
+ def read_timeout(self) -> typing.Optional[_Duration_4839e8c3]:
3634
+ '''Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout.
3635
+
3636
+ The valid range is from 1 to 180 seconds, inclusive.
3637
+
3638
+ Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota
3639
+ has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time.
3640
+
3641
+ :default: Duration.seconds(30)
3642
+ '''
3643
+ result = self._values.get("read_timeout")
3644
+ return typing.cast(typing.Optional[_Duration_4839e8c3], result)
1869
3645
 
1870
3646
  def __eq__(self, rhs: typing.Any) -> builtins.bool:
1871
3647
  return isinstance(rhs, self.__class__) and rhs._values == self._values
@@ -1874,7 +3650,7 @@ class S3OriginProps(_OriginProps_0675928d):
1874
3650
  return not (rhs == self)
1875
3651
 
1876
3652
  def __repr__(self) -> str:
1877
- return "S3OriginProps(%s)" % ", ".join(
3653
+ return "S3StaticWebsiteOriginProps(%s)" % ", ".join(
1878
3654
  k + "=" + repr(v) for k, v in self._values.items()
1879
3655
  )
1880
3656
 
@@ -1890,8 +3666,14 @@ __all__ = [
1890
3666
  "OriginGroupProps",
1891
3667
  "RestApiOrigin",
1892
3668
  "RestApiOriginProps",
3669
+ "S3BucketOrigin",
3670
+ "S3BucketOriginBaseProps",
3671
+ "S3BucketOriginWithOACProps",
3672
+ "S3BucketOriginWithOAIProps",
1893
3673
  "S3Origin",
1894
3674
  "S3OriginProps",
3675
+ "S3StaticWebsiteOrigin",
3676
+ "S3StaticWebsiteOriginProps",
1895
3677
  ]
1896
3678
 
1897
3679
  publication.publish()
@@ -1905,6 +3687,7 @@ def _typecheckingstub__fcda903697b26acfe2149a285d5a64619682b675affb52f4ae2d1aca4
1905
3687
  connection_attempts: typing.Optional[jsii.Number] = None,
1906
3688
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1907
3689
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3690
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1908
3691
  origin_id: typing.Optional[builtins.str] = None,
1909
3692
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1910
3693
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -1917,6 +3700,7 @@ def _typecheckingstub__56d340a9ac5dd93c6aa22cb98bcbc860fb23f8d247b53c2cd1a51ecd8
1917
3700
  connection_attempts: typing.Optional[jsii.Number] = None,
1918
3701
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1919
3702
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3703
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1920
3704
  origin_id: typing.Optional[builtins.str] = None,
1921
3705
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1922
3706
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -1940,6 +3724,7 @@ def _typecheckingstub__57d13f69f251622e0723aa73c3eb93e482e0deb7a7b1e8439c7d7ad35
1940
3724
  connection_attempts: typing.Optional[jsii.Number] = None,
1941
3725
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1942
3726
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3727
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1943
3728
  origin_id: typing.Optional[builtins.str] = None,
1944
3729
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1945
3730
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -1952,6 +3737,7 @@ def _typecheckingstub__13f43bf70f0a97ee8ca0e4f7aca38d43089ed2bc254d5c2b57c73b51c
1952
3737
  connection_attempts: typing.Optional[jsii.Number] = None,
1953
3738
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1954
3739
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3740
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1955
3741
  origin_id: typing.Optional[builtins.str] = None,
1956
3742
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1957
3743
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -1979,6 +3765,7 @@ def _typecheckingstub__2e5124d4f469d6539077a529c09cfba685fe4a7037b9417216b18f6cc
1979
3765
  connection_attempts: typing.Optional[jsii.Number] = None,
1980
3766
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1981
3767
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3768
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1982
3769
  origin_id: typing.Optional[builtins.str] = None,
1983
3770
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1984
3771
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -1991,6 +3778,7 @@ def _typecheckingstub__c72b63200b184ae3f51c9b6a19be2eef9bddae313ee00c7378396c0dc
1991
3778
  connection_attempts: typing.Optional[jsii.Number] = None,
1992
3779
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
1993
3780
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3781
+ origin_access_control_id: typing.Optional[builtins.str] = None,
1994
3782
  origin_id: typing.Optional[builtins.str] = None,
1995
3783
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
1996
3784
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -2009,6 +3797,7 @@ def _typecheckingstub__428f309ea8c48c002d77db24802c77164c9607d40492e08c4b243080f
2009
3797
  scope: _constructs_77d1e7e8.Construct,
2010
3798
  *,
2011
3799
  origin_id: builtins.str,
3800
+ distribution_id: typing.Optional[builtins.str] = None,
2012
3801
  ) -> None:
2013
3802
  """Type checking stubs"""
2014
3803
  pass
@@ -2031,6 +3820,7 @@ def _typecheckingstub__56b6a9ee9b4e8ac821a25cc86fc2ff9f7490081ff9a35a5c551216af6
2031
3820
  connection_attempts: typing.Optional[jsii.Number] = None,
2032
3821
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2033
3822
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3823
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2034
3824
  origin_id: typing.Optional[builtins.str] = None,
2035
3825
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
2036
3826
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -2043,6 +3833,7 @@ def _typecheckingstub__0eca8c8f76c90eb80c45563b1a8eb9b9f1868ad621b45412a4cb93529
2043
3833
  connection_attempts: typing.Optional[jsii.Number] = None,
2044
3834
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2045
3835
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3836
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2046
3837
  origin_id: typing.Optional[builtins.str] = None,
2047
3838
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
2048
3839
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -2053,6 +3844,114 @@ def _typecheckingstub__0eca8c8f76c90eb80c45563b1a8eb9b9f1868ad621b45412a4cb93529
2053
3844
  """Type checking stubs"""
2054
3845
  pass
2055
3846
 
3847
+ def _typecheckingstub__3cb1f0b82603224c7fbeb25b954355d9b19c8971c1f19cce6cc99b4579024f0f(
3848
+ bucket: _IBucket_42e086fd,
3849
+ *,
3850
+ origin_path: typing.Optional[builtins.str] = None,
3851
+ connection_attempts: typing.Optional[jsii.Number] = None,
3852
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3853
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3854
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3855
+ origin_id: typing.Optional[builtins.str] = None,
3856
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3857
+ origin_shield_region: typing.Optional[builtins.str] = None,
3858
+ ) -> None:
3859
+ """Type checking stubs"""
3860
+ pass
3861
+
3862
+ def _typecheckingstub__f676436dc530972f0e77d574f148913989a94d38c9af09bff28450e29ace8acb(
3863
+ bucket: _IBucket_42e086fd,
3864
+ *,
3865
+ origin_path: typing.Optional[builtins.str] = None,
3866
+ connection_attempts: typing.Optional[jsii.Number] = None,
3867
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3868
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3869
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3870
+ origin_id: typing.Optional[builtins.str] = None,
3871
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3872
+ origin_shield_region: typing.Optional[builtins.str] = None,
3873
+ ) -> None:
3874
+ """Type checking stubs"""
3875
+ pass
3876
+
3877
+ def _typecheckingstub__23afb965139dc34be23cec3ad5506b4c5de509db9c0d653bed7877f463b7a9db(
3878
+ bucket: _IBucket_42e086fd,
3879
+ *,
3880
+ origin_access_control: typing.Optional[_IOriginAccessControl_82a6fe5a] = None,
3881
+ origin_access_levels: typing.Optional[typing.Sequence[_AccessLevel_315d9a76]] = None,
3882
+ origin_path: typing.Optional[builtins.str] = None,
3883
+ connection_attempts: typing.Optional[jsii.Number] = None,
3884
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3885
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3886
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3887
+ origin_id: typing.Optional[builtins.str] = None,
3888
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3889
+ origin_shield_region: typing.Optional[builtins.str] = None,
3890
+ ) -> None:
3891
+ """Type checking stubs"""
3892
+ pass
3893
+
3894
+ def _typecheckingstub__13e7421c65d5fbb92fc686fa854daca3e90dc002f3e99da4b4757e32e3c4105d(
3895
+ bucket: _IBucket_42e086fd,
3896
+ *,
3897
+ origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
3898
+ origin_path: typing.Optional[builtins.str] = None,
3899
+ connection_attempts: typing.Optional[jsii.Number] = None,
3900
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3901
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3902
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3903
+ origin_id: typing.Optional[builtins.str] = None,
3904
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3905
+ origin_shield_region: typing.Optional[builtins.str] = None,
3906
+ ) -> None:
3907
+ """Type checking stubs"""
3908
+ pass
3909
+
3910
+ def _typecheckingstub__c5e580c31fe629b713e1ecbf9905ebb4220e152805ab34129f693f2c4d4db098(
3911
+ *,
3912
+ connection_attempts: typing.Optional[jsii.Number] = None,
3913
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3914
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3915
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3916
+ origin_id: typing.Optional[builtins.str] = None,
3917
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3918
+ origin_shield_region: typing.Optional[builtins.str] = None,
3919
+ origin_path: typing.Optional[builtins.str] = None,
3920
+ ) -> None:
3921
+ """Type checking stubs"""
3922
+ pass
3923
+
3924
+ def _typecheckingstub__1af53a7ded1427e29cc874af45efdfe026a0004a1f2782a5bc936dbfcb4fe7a4(
3925
+ *,
3926
+ connection_attempts: typing.Optional[jsii.Number] = None,
3927
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3928
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3929
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3930
+ origin_id: typing.Optional[builtins.str] = None,
3931
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3932
+ origin_shield_region: typing.Optional[builtins.str] = None,
3933
+ origin_path: typing.Optional[builtins.str] = None,
3934
+ origin_access_control: typing.Optional[_IOriginAccessControl_82a6fe5a] = None,
3935
+ origin_access_levels: typing.Optional[typing.Sequence[_AccessLevel_315d9a76]] = None,
3936
+ ) -> None:
3937
+ """Type checking stubs"""
3938
+ pass
3939
+
3940
+ def _typecheckingstub__4b64c18ef31b660c450eee84b6738d7bbd960797e1788e068be9663127832c26(
3941
+ *,
3942
+ connection_attempts: typing.Optional[jsii.Number] = None,
3943
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
3944
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3945
+ origin_access_control_id: typing.Optional[builtins.str] = None,
3946
+ origin_id: typing.Optional[builtins.str] = None,
3947
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
3948
+ origin_shield_region: typing.Optional[builtins.str] = None,
3949
+ origin_path: typing.Optional[builtins.str] = None,
3950
+ origin_access_identity: typing.Optional[_IOriginAccessIdentity_a922494c] = None,
3951
+ ) -> None:
3952
+ """Type checking stubs"""
3953
+ pass
3954
+
2056
3955
  def _typecheckingstub__9ba8623373b0faa9ac55c816167da21a58e0753e0dd032b1f3e6ccd0bd977994(
2057
3956
  bucket: _IBucket_42e086fd,
2058
3957
  *,
@@ -2061,6 +3960,7 @@ def _typecheckingstub__9ba8623373b0faa9ac55c816167da21a58e0753e0dd032b1f3e6ccd0b
2061
3960
  connection_attempts: typing.Optional[jsii.Number] = None,
2062
3961
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2063
3962
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3963
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2064
3964
  origin_id: typing.Optional[builtins.str] = None,
2065
3965
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
2066
3966
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -2072,6 +3972,7 @@ def _typecheckingstub__1731b0d7a385b196730b287be11e2cb13fa03d064ae3ffbfd55c5422a
2072
3972
  scope: _constructs_77d1e7e8.Construct,
2073
3973
  *,
2074
3974
  origin_id: builtins.str,
3975
+ distribution_id: typing.Optional[builtins.str] = None,
2075
3976
  ) -> None:
2076
3977
  """Type checking stubs"""
2077
3978
  pass
@@ -2081,6 +3982,7 @@ def _typecheckingstub__bbd2a0ca1bf4d32899d90ea633e3ac416a6fa29972ee055a5866ec269
2081
3982
  connection_attempts: typing.Optional[jsii.Number] = None,
2082
3983
  connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
2083
3984
  custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
3985
+ origin_access_control_id: typing.Optional[builtins.str] = None,
2084
3986
  origin_id: typing.Optional[builtins.str] = None,
2085
3987
  origin_shield_enabled: typing.Optional[builtins.bool] = None,
2086
3988
  origin_shield_region: typing.Optional[builtins.str] = None,
@@ -2089,3 +3991,44 @@ def _typecheckingstub__bbd2a0ca1bf4d32899d90ea633e3ac416a6fa29972ee055a5866ec269
2089
3991
  ) -> None:
2090
3992
  """Type checking stubs"""
2091
3993
  pass
3994
+
3995
+ def _typecheckingstub__f0edd2083352b96faf3ea9eb05136629dff841fa272ecdb6dfb52772a77b9b22(
3996
+ bucket: _IBucket_42e086fd,
3997
+ *,
3998
+ http_port: typing.Optional[jsii.Number] = None,
3999
+ https_port: typing.Optional[jsii.Number] = None,
4000
+ keepalive_timeout: typing.Optional[_Duration_4839e8c3] = None,
4001
+ origin_ssl_protocols: typing.Optional[typing.Sequence[_OriginSslPolicy_d65cede2]] = None,
4002
+ protocol_policy: typing.Optional[_OriginProtocolPolicy_967ed73c] = None,
4003
+ read_timeout: typing.Optional[_Duration_4839e8c3] = None,
4004
+ origin_path: typing.Optional[builtins.str] = None,
4005
+ connection_attempts: typing.Optional[jsii.Number] = None,
4006
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
4007
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
4008
+ origin_access_control_id: typing.Optional[builtins.str] = None,
4009
+ origin_id: typing.Optional[builtins.str] = None,
4010
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
4011
+ origin_shield_region: typing.Optional[builtins.str] = None,
4012
+ ) -> None:
4013
+ """Type checking stubs"""
4014
+ pass
4015
+
4016
+ def _typecheckingstub__5bc18cdba7c0e6d7d0a68d2a1cf3c3f91f50a7e3e7384f5f62ebee6006adbb85(
4017
+ *,
4018
+ connection_attempts: typing.Optional[jsii.Number] = None,
4019
+ connection_timeout: typing.Optional[_Duration_4839e8c3] = None,
4020
+ custom_headers: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
4021
+ origin_access_control_id: typing.Optional[builtins.str] = None,
4022
+ origin_id: typing.Optional[builtins.str] = None,
4023
+ origin_shield_enabled: typing.Optional[builtins.bool] = None,
4024
+ origin_shield_region: typing.Optional[builtins.str] = None,
4025
+ origin_path: typing.Optional[builtins.str] = None,
4026
+ http_port: typing.Optional[jsii.Number] = None,
4027
+ https_port: typing.Optional[jsii.Number] = None,
4028
+ keepalive_timeout: typing.Optional[_Duration_4839e8c3] = None,
4029
+ origin_ssl_protocols: typing.Optional[typing.Sequence[_OriginSslPolicy_d65cede2]] = None,
4030
+ protocol_policy: typing.Optional[_OriginProtocolPolicy_967ed73c] = None,
4031
+ read_timeout: typing.Optional[_Duration_4839e8c3] = None,
4032
+ ) -> None:
4033
+ """Type checking stubs"""
4034
+ pass