aws-cdk-lib 2.73.0__py3-none-any.whl → 2.76.0__py3-none-any.whl

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

Potentially problematic release.


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

Files changed (111) hide show
  1. aws_cdk/__init__.py +245 -259
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.73.0.jsii.tgz → aws-cdk-lib@2.76.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_amplifyuibuilder/__init__.py +182 -214
  5. aws_cdk/aws_apigateway/__init__.py +95 -148
  6. aws_cdk/aws_appconfig/__init__.py +8 -4
  7. aws_cdk/aws_appflow/__init__.py +27 -52
  8. aws_cdk/aws_appmesh/__init__.py +91 -200
  9. aws_cdk/aws_apprunner/__init__.py +4 -16
  10. aws_cdk/aws_appstream/__init__.py +18 -82
  11. aws_cdk/aws_athena/__init__.py +18 -32
  12. aws_cdk/aws_backup/__init__.py +48 -86
  13. aws_cdk/aws_batch/__init__.py +9 -2
  14. aws_cdk/aws_billingconductor/__init__.py +12 -7
  15. aws_cdk/aws_budgets/__init__.py +8 -17
  16. aws_cdk/aws_certificatemanager/__init__.py +7 -4
  17. aws_cdk/aws_cloudfront/__init__.py +14 -11
  18. aws_cdk/aws_cloudfront_origins/__init__.py +18 -8
  19. aws_cdk/aws_cloudtrail/__init__.py +7 -14
  20. aws_cdk/aws_cloudwatch/__init__.py +63 -35
  21. aws_cdk/aws_codebuild/__init__.py +10 -13
  22. aws_cdk/aws_codecommit/__init__.py +0 -1
  23. aws_cdk/aws_codedeploy/__init__.py +165 -162
  24. aws_cdk/aws_codegurureviewer/__init__.py +4 -4
  25. aws_cdk/aws_codepipeline/__init__.py +0 -4
  26. aws_cdk/aws_codepipeline_actions/__init__.py +16 -164
  27. aws_cdk/aws_cognito/__init__.py +195 -100
  28. aws_cdk/aws_config/__init__.py +28 -51
  29. aws_cdk/aws_connectcampaigns/__init__.py +5 -6
  30. aws_cdk/aws_databrew/__init__.py +5 -6
  31. aws_cdk/aws_dlm/__init__.py +33 -71
  32. aws_cdk/aws_docdb/__init__.py +20 -76
  33. aws_cdk/aws_dynamodb/__init__.py +29 -22
  34. aws_cdk/aws_ec2/__init__.py +2414 -603
  35. aws_cdk/aws_ecr/__init__.py +1 -2
  36. aws_cdk/aws_ecr_assets/__init__.py +27 -14
  37. aws_cdk/aws_ecs/__init__.py +458 -163
  38. aws_cdk/aws_ecs_patterns/__init__.py +13 -11
  39. aws_cdk/aws_eks/__init__.py +13 -8
  40. aws_cdk/aws_elasticloadbalancing/__init__.py +16 -9
  41. aws_cdk/aws_elasticloadbalancingv2/__init__.py +142 -82
  42. aws_cdk/aws_elasticloadbalancingv2_actions/__init__.py +126 -61
  43. aws_cdk/aws_elasticsearch/__init__.py +0 -7
  44. aws_cdk/aws_emr/__init__.py +7 -16
  45. aws_cdk/aws_emrserverless/__init__.py +14 -18
  46. aws_cdk/aws_events/__init__.py +33 -29
  47. aws_cdk/aws_events_targets/__init__.py +248 -89
  48. aws_cdk/aws_frauddetector/__init__.py +3 -4
  49. aws_cdk/aws_fsx/__init__.py +13 -7
  50. aws_cdk/aws_gamelift/__init__.py +11 -20
  51. aws_cdk/aws_grafana/__init__.py +4 -4
  52. aws_cdk/aws_iam/__init__.py +21 -25
  53. aws_cdk/aws_imagebuilder/__init__.py +58 -80
  54. aws_cdk/aws_internetmonitor/__init__.py +18 -10
  55. aws_cdk/aws_iot/__init__.py +16 -10
  56. aws_cdk/aws_iotcoredeviceadvisor/__init__.py +16 -26
  57. aws_cdk/aws_iotevents/__init__.py +6 -4
  58. aws_cdk/aws_iotfleetwise/__init__.py +27 -40
  59. aws_cdk/aws_iotsitewise/__init__.py +8 -5
  60. aws_cdk/aws_iotwireless/__init__.py +14 -9
  61. aws_cdk/aws_kinesisfirehose/__init__.py +21 -38
  62. aws_cdk/aws_lambda/__init__.py +76 -53
  63. aws_cdk/aws_lambda_event_sources/__init__.py +6 -21
  64. aws_cdk/aws_logs/__init__.py +5 -7
  65. aws_cdk/aws_macie/__init__.py +28 -23
  66. aws_cdk/aws_mediaconnect/__init__.py +5 -8
  67. aws_cdk/aws_mediaconvert/__init__.py +2 -2
  68. aws_cdk/aws_medialive/__init__.py +2 -4
  69. aws_cdk/aws_mediapackage/__init__.py +9 -18
  70. aws_cdk/aws_memorydb/__init__.py +5 -10
  71. aws_cdk/aws_mwaa/__init__.py +8 -4
  72. aws_cdk/aws_neptune/__init__.py +4 -4
  73. aws_cdk/aws_networkfirewall/__init__.py +8 -4
  74. aws_cdk/aws_networkmanager/__init__.py +4 -4
  75. aws_cdk/aws_nimblestudio/__init__.py +25 -45
  76. aws_cdk/aws_opensearchservice/__init__.py +0 -1
  77. aws_cdk/aws_panorama/__init__.py +11 -12
  78. aws_cdk/aws_personalize/__init__.py +46 -72
  79. aws_cdk/aws_pinpoint/__init__.py +36 -65
  80. aws_cdk/aws_quicksight/__init__.py +9972 -13374
  81. aws_cdk/aws_rds/__init__.py +53 -22
  82. aws_cdk/aws_route53/__init__.py +8 -16
  83. aws_cdk/aws_route53_targets/__init__.py +2 -4
  84. aws_cdk/aws_s3/__init__.py +41 -90
  85. aws_cdk/aws_s3_notifications/__init__.py +0 -3
  86. aws_cdk/aws_sagemaker/__init__.py +16 -10
  87. aws_cdk/aws_secretsmanager/__init__.py +17 -14
  88. aws_cdk/aws_servicecatalog/__init__.py +60 -83
  89. aws_cdk/aws_servicediscovery/__init__.py +4 -6
  90. aws_cdk/aws_ses/__init__.py +734 -28
  91. aws_cdk/aws_sns/__init__.py +4 -8
  92. aws_cdk/aws_ssm/__init__.py +19 -23
  93. aws_cdk/aws_ssmcontacts/__init__.py +10 -6
  94. aws_cdk/aws_ssmincidents/__init__.py +2 -1
  95. aws_cdk/aws_sso/__init__.py +4 -4
  96. aws_cdk/aws_stepfunctions/__init__.py +6 -15
  97. aws_cdk/aws_stepfunctions_tasks/__init__.py +51 -24
  98. aws_cdk/aws_timestream/__init__.py +22 -28
  99. aws_cdk/aws_transfer/__init__.py +188 -86
  100. aws_cdk/aws_wafv2/__init__.py +54 -38
  101. aws_cdk/aws_xray/__init__.py +15 -22
  102. aws_cdk/cloud_assembly_schema/__init__.py +14 -6
  103. aws_cdk/custom_resources/__init__.py +2 -3
  104. aws_cdk/pipelines/__init__.py +104 -134
  105. aws_cdk/triggers/__init__.py +46 -61
  106. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/METADATA +47 -92
  107. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/RECORD +111 -111
  108. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/LICENSE +0 -0
  109. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/NOTICE +0 -0
  110. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/WHEEL +0 -0
  111. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,9 @@
1
1
  '''
2
2
  # Amazon S3 Construct Library
3
3
 
4
- Define an unencrypted S3 bucket.
4
+ Define an S3 bucket.
5
5
 
6
6
  ```python
7
- # Example automatically generated from non-compiling source. May contain errors.
8
7
  bucket = s3.Bucket(self, "MyFirstBucket")
9
8
  ```
10
9
 
@@ -34,7 +33,6 @@ bucket = s3.Bucket(self, "MyFirstBucket")
34
33
  Define a KMS-encrypted bucket:
35
34
 
36
35
  ```python
37
- # Example automatically generated from non-compiling source. May contain errors.
38
36
  bucket = s3.Bucket(self, "MyEncryptedBucket",
39
37
  encryption=s3.BucketEncryption.KMS
40
38
  )
@@ -46,7 +44,6 @@ assert(bucket.encryption_key instanceof kms.Key)
46
44
  You can also supply your own key:
47
45
 
48
46
  ```python
49
- # Example automatically generated from non-compiling source. May contain errors.
50
47
  my_kms_key = kms.Key(self, "MyKey")
51
48
 
52
49
  bucket = s3.Bucket(self, "MyEncryptedBucket",
@@ -60,7 +57,6 @@ assert(bucket.encryption_key == my_kms_key)
60
57
  Enable KMS-SSE encryption via [S3 Bucket Keys](https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html):
61
58
 
62
59
  ```python
63
- # Example automatically generated from non-compiling source. May contain errors.
64
60
  bucket = s3.Bucket(self, "MyEncryptedBucket",
65
61
  encryption=s3.BucketEncryption.KMS,
66
62
  bucket_key_enabled=True
@@ -70,7 +66,6 @@ bucket = s3.Bucket(self, "MyEncryptedBucket",
70
66
  Use `BucketEncryption.ManagedKms` to use the S3 master KMS key:
71
67
 
72
68
  ```python
73
- # Example automatically generated from non-compiling source. May contain errors.
74
69
  bucket = s3.Bucket(self, "Buck",
75
70
  encryption=s3.BucketEncryption.KMS_MANAGED
76
71
  )
@@ -84,7 +79,6 @@ A bucket policy will be automatically created for the bucket upon the first call
84
79
  `addToResourcePolicy(statement)`:
85
80
 
86
81
  ```python
87
- # Example automatically generated from non-compiling source. May contain errors.
88
82
  bucket = s3.Bucket(self, "MyBucket")
89
83
  result = bucket.add_to_resource_policy(
90
84
  iam.PolicyStatement(
@@ -98,7 +92,6 @@ If you try to add a policy statement to an existing bucket, this method will
98
92
  not do anything:
99
93
 
100
94
  ```python
101
- # Example automatically generated from non-compiling source. May contain errors.
102
95
  bucket = s3.Bucket.from_bucket_name(self, "existingBucket", "bucket-name")
103
96
 
104
97
  # No policy statement will be added to the resource
@@ -115,7 +108,6 @@ already has a policy attached, let alone to re-use that policy to add more
115
108
  statements to it. We recommend that you always check the result of the call:
116
109
 
117
110
  ```python
118
- # Example automatically generated from non-compiling source. May contain errors.
119
111
  bucket = s3.Bucket(self, "MyBucket")
120
112
  result = bucket.add_to_resource_policy(
121
113
  iam.PolicyStatement(
@@ -132,7 +124,6 @@ The bucket policy can be directly accessed after creation to add statements or
132
124
  adjust the removal policy.
133
125
 
134
126
  ```python
135
- # Example automatically generated from non-compiling source. May contain errors.
136
127
  bucket = s3.Bucket(self, "MyBucket")
137
128
  bucket.policy.apply_removal_policy(cdk.RemovalPolicy.RETAIN)
138
129
  ```
@@ -142,7 +133,6 @@ Instead, buckets have "grant" methods called to give prepackaged sets of permiss
142
133
  to other resources. For example:
143
134
 
144
135
  ```python
145
- # Example automatically generated from non-compiling source. May contain errors.
146
136
  # my_lambda: lambda.Function
147
137
 
148
138
 
@@ -160,7 +150,6 @@ from the bucket.
160
150
  To require all requests use Secure Socket Layer (SSL):
161
151
 
162
152
  ```python
163
- # Example automatically generated from non-compiling source. May contain errors.
164
153
  bucket = s3.Bucket(self, "Bucket",
165
154
  enforce_sSL=True
166
155
  )
@@ -171,11 +160,10 @@ bucket = s3.Bucket(self, "Bucket",
171
160
  To use a bucket in a different stack in the same CDK application, pass the object to the other stack:
172
161
 
173
162
  ```python
174
- # Example automatically generated from non-compiling source. May contain errors.
175
163
  #
176
164
  # Stack that defines the bucket
177
165
  #
178
- class Producer(cdk.Stack):
166
+ class Producer(Stack):
179
167
 
180
168
  def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None, crossRegionReferences=None, permissionsBoundary=None):
181
169
  super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting, crossRegionReferences=crossRegionReferences, permissionsBoundary=permissionsBoundary)
@@ -188,13 +176,14 @@ class Producer(cdk.Stack):
188
176
  #
189
177
  # Stack that consumes the bucket
190
178
  #
191
- class Consumer(cdk.Stack):
179
+ class Consumer(Stack):
192
180
  def __init__(self, scope, id, *, userBucket, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None, crossRegionReferences=None, permissionsBoundary=None):
193
181
  super().__init__(scope, id, userBucket=userBucket, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting, crossRegionReferences=crossRegionReferences, permissionsBoundary=permissionsBoundary)
194
182
 
195
183
  user = iam.User(self, "MyUser")
196
184
  user_bucket.grant_read_write(user)
197
185
 
186
+ app = App()
198
187
  producer = Producer(app, "ProducerStack")
199
188
  Consumer(app, "ConsumerStack", user_bucket=producer.my_bucket)
200
189
  ```
@@ -206,7 +195,6 @@ factory method. This method accepts `BucketAttributes` which describes the prope
206
195
  existing bucket:
207
196
 
208
197
  ```python
209
- # Example automatically generated from non-compiling source. May contain errors.
210
198
  # my_lambda: lambda.Function
211
199
 
212
200
  bucket = s3.Bucket.from_bucket_attributes(self, "ImportedBucket",
@@ -224,7 +212,6 @@ Alternatively, short-hand factories are available as `Bucket.fromBucketName` and
224
212
  name or ARN respectively:
225
213
 
226
214
  ```python
227
- # Example automatically generated from non-compiling source. May contain errors.
228
215
  by_name = s3.Bucket.from_bucket_name(self, "BucketByName", "my-bucket")
229
216
  by_arn = s3.Bucket.from_bucket_arn(self, "BucketByArn", "arn:aws:s3:::my-bucket")
230
217
  ```
@@ -233,7 +220,6 @@ The bucket's region defaults to the current stack's region, but can also be expl
233
220
  regional properties needs to contain the correct values.
234
221
 
235
222
  ```python
236
- # Example automatically generated from non-compiling source. May contain errors.
237
223
  my_cross_region_bucket = s3.Bucket.from_bucket_attributes(self, "CrossRegionImport",
238
224
  bucket_arn="arn:aws:s3:::my-bucket",
239
225
  region="us-east-1"
@@ -253,7 +239,6 @@ these common use cases.
253
239
  The following example will subscribe an SNS topic to be notified of all `s3:ObjectCreated:*` events:
254
240
 
255
241
  ```python
256
- # Example automatically generated from non-compiling source. May contain errors.
257
242
  bucket = s3.Bucket(self, "MyBucket")
258
243
  topic = sns.Topic(self, "MyTopic")
259
244
  bucket.add_event_notification(s3.EventType.OBJECT_CREATED, s3n.SnsDestination(topic))
@@ -269,7 +254,6 @@ following example will notify `myQueue` when objects prefixed with `foo/` and
269
254
  have the `.jpg` suffix are removed from the bucket.
270
255
 
271
256
  ```python
272
- # Example automatically generated from non-compiling source. May contain errors.
273
257
  # my_queue: sqs.Queue
274
258
 
275
259
  bucket = s3.Bucket(self, "MyBucket")
@@ -282,7 +266,6 @@ bucket.add_event_notification(s3.EventType.OBJECT_REMOVED, s3n.SqsDestination(my
282
266
  Adding notifications on existing buckets:
283
267
 
284
268
  ```python
285
- # Example automatically generated from non-compiling source. May contain errors.
286
269
  # topic: sns.Topic
287
270
 
288
271
  bucket = s3.Bucket.from_bucket_attributes(self, "ImportedBucket",
@@ -297,7 +280,6 @@ function that implements this feature. If you want to use your own role instead,
297
280
  you should provide it in the `Bucket` constructor:
298
281
 
299
282
  ```python
300
- # Example automatically generated from non-compiling source. May contain errors.
301
283
  # my_role: iam.IRole
302
284
 
303
285
  bucket = s3.Bucket(self, "MyBucket",
@@ -312,7 +294,6 @@ If you’re passing an imported role, and you don’t want this to happen, confi
312
294
  it to be immutable:
313
295
 
314
296
  ```python
315
- # Example automatically generated from non-compiling source. May contain errors.
316
297
  imported_role = iam.Role.from_role_arn(self, "role", "arn:aws:iam::123456789012:role/RoleName",
317
298
  mutable=False
318
299
  )
@@ -329,7 +310,6 @@ Unlike other destinations, you don't need to select which event types you want t
329
310
  The following example will enable EventBridge notifications:
330
311
 
331
312
  ```python
332
- # Example automatically generated from non-compiling source. May contain errors.
333
313
  bucket = s3.Bucket(self, "MyEventBridgeBucket",
334
314
  event_bridge_enabled=True
335
315
  )
@@ -342,7 +322,6 @@ Use `blockPublicAccess` to specify [block public access settings](https://docs.a
342
322
  Enable all block public access settings:
343
323
 
344
324
  ```python
345
- # Example automatically generated from non-compiling source. May contain errors.
346
325
  bucket = s3.Bucket(self, "MyBlockedBucket",
347
326
  block_public_access=s3.BlockPublicAccess.BLOCK_ALL
348
327
  )
@@ -351,7 +330,6 @@ bucket = s3.Bucket(self, "MyBlockedBucket",
351
330
  Block and ignore public ACLs:
352
331
 
353
332
  ```python
354
- # Example automatically generated from non-compiling source. May contain errors.
355
333
  bucket = s3.Bucket(self, "MyBlockedBucket",
356
334
  block_public_access=s3.BlockPublicAccess.BLOCK_ACLS
357
335
  )
@@ -360,7 +338,6 @@ bucket = s3.Bucket(self, "MyBlockedBucket",
360
338
  Alternatively, specify the settings manually:
361
339
 
362
340
  ```python
363
- # Example automatically generated from non-compiling source. May contain errors.
364
341
  bucket = s3.Bucket(self, "MyBlockedBucket",
365
342
  block_public_access=s3.BlockPublicAccess(block_public_policy=True)
366
343
  )
@@ -373,7 +350,6 @@ When `blockPublicPolicy` is set to `true`, `grantPublicRead()` throws an error.
373
350
  Use `serverAccessLogsBucket` to describe where server access logs are to be stored.
374
351
 
375
352
  ```python
376
- # Example automatically generated from non-compiling source. May contain errors.
377
353
  access_logs_bucket = s3.Bucket(self, "AccessLogsBucket")
378
354
 
379
355
  bucket = s3.Bucket(self, "MyBucket",
@@ -384,7 +360,6 @@ bucket = s3.Bucket(self, "MyBucket",
384
360
  It's also possible to specify a prefix for Amazon S3 to assign to all log object keys.
385
361
 
386
362
  ```python
387
- # Example automatically generated from non-compiling source. May contain errors.
388
363
  access_logs_bucket = s3.Bucket(self, "AccessLogsBucket")
389
364
 
390
365
  bucket = s3.Bucket(self, "MyBucket",
@@ -403,7 +378,6 @@ bucket support using bucket policy instead of ACLs), you can set object ownershi
403
378
  to [bucket owner enforced](#bucket-owner-enforced-recommended), as is recommended.
404
379
 
405
380
  ```python
406
- # Example automatically generated from non-compiling source. May contain errors.
407
381
  access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
408
382
  object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
409
383
  )
@@ -421,7 +395,6 @@ An [inventory](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory
421
395
  You can configure multiple inventory lists for a bucket. You can configure what object metadata to include in the inventory, whether to list all object versions or only current versions, where to store the inventory list file output, and whether to generate the inventory on a daily or weekly basis.
422
396
 
423
397
  ```python
424
- # Example automatically generated from non-compiling source. May contain errors.
425
398
  inventory_bucket = s3.Bucket(self, "InventoryBucket")
426
399
 
427
400
  data_bucket = s3.Bucket(self, "DataBucket",
@@ -470,7 +443,6 @@ You can use the two following properties to specify the bucket [redirection poli
470
443
  You can statically redirect a to a given Bucket URL or any other host name with `websiteRedirect`:
471
444
 
472
445
  ```python
473
- # Example automatically generated from non-compiling source. May contain errors.
474
446
  bucket = s3.Bucket(self, "MyRedirectedBucket",
475
447
  website_redirect=s3.RedirectTarget(host_name="www.example.com")
476
448
  )
@@ -481,7 +453,6 @@ bucket = s3.Bucket(self, "MyRedirectedBucket",
481
453
  Alternatively, you can also define multiple `websiteRoutingRules`, to define complex, conditional redirections:
482
454
 
483
455
  ```python
484
- # Example automatically generated from non-compiling source. May contain errors.
485
456
  bucket = s3.Bucket(self, "MyRedirectedBucket",
486
457
  website_routing_rules=[s3.RoutingRule(
487
458
  host_name="www.example.com",
@@ -514,7 +485,6 @@ We recommend to use Virtual Hosted-Style URL for newly made bucket.
514
485
  You can generate both of them.
515
486
 
516
487
  ```python
517
- # Example automatically generated from non-compiling source. May contain errors.
518
488
  bucket = s3.Bucket(self, "MyBucket")
519
489
  bucket.url_for_object("objectname") # Path-Style URL
520
490
  bucket.virtual_hosted_url_for_object("objectname") # Virtual Hosted-Style URL
@@ -530,7 +500,6 @@ You can use one of following properties to specify the bucket [object Ownership]
530
500
  The Uploading account will own the object.
531
501
 
532
502
  ```python
533
- # Example automatically generated from non-compiling source. May contain errors.
534
503
  s3.Bucket(self, "MyBucket",
535
504
  object_ownership=s3.ObjectOwnership.OBJECT_WRITER
536
505
  )
@@ -541,7 +510,6 @@ s3.Bucket(self, "MyBucket",
541
510
  The bucket owner will own the object if the object is uploaded with the bucket-owner-full-control canned ACL. Without this setting and canned ACL, the object is uploaded and remains owned by the uploading account.
542
511
 
543
512
  ```python
544
- # Example automatically generated from non-compiling source. May contain errors.
545
513
  s3.Bucket(self, "MyBucket",
546
514
  object_ownership=s3.ObjectOwnership.BUCKET_OWNER_PREFERRED
547
515
  )
@@ -554,7 +522,6 @@ over every object in the bucket. ACLs no longer affect permissions to data in th
554
522
  S3 bucket. The bucket uses policies to define access control.
555
523
 
556
524
  ```python
557
- # Example automatically generated from non-compiling source. May contain errors.
558
525
  s3.Bucket(self, "MyBucket",
559
526
  object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
560
527
  )
@@ -577,7 +544,6 @@ To override this and force all objects to get deleted during bucket deletion,
577
544
  enable the`autoDeleteObjects` option.
578
545
 
579
546
  ```python
580
- # Example automatically generated from non-compiling source. May contain errors.
581
547
  bucket = s3.Bucket(self, "MyTempFileBucket",
582
548
  removal_policy=cdk.RemovalPolicy.DESTROY,
583
549
  auto_delete_objects=True
@@ -594,7 +560,6 @@ by deploying with CDK version `1.126.0` or later **before** switching this value
594
560
  [Transfer Acceleration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html) can be configured to enable fast, easy, and secure transfers of files over long distances:
595
561
 
596
562
  ```python
597
- # Example automatically generated from non-compiling source. May contain errors.
598
563
  bucket = s3.Bucket(self, "MyBucket",
599
564
  transfer_acceleration=True
600
565
  )
@@ -603,7 +568,6 @@ bucket = s3.Bucket(self, "MyBucket",
603
568
  To access the bucket that is enabled for Transfer Acceleration, you must use a special endpoint. The URL can be generated using method `transferAccelerationUrlForObject`:
604
569
 
605
570
  ```python
606
- # Example automatically generated from non-compiling source. May contain errors.
607
571
  bucket = s3.Bucket(self, "MyBucket",
608
572
  transfer_acceleration=True
609
573
  )
@@ -615,13 +579,12 @@ bucket.transfer_acceleration_url_for_object("objectname")
615
579
  [Intelligent Tiering](https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering.html) can be configured to automatically move files to glacier:
616
580
 
617
581
  ```python
618
- # Example automatically generated from non-compiling source. May contain errors.
619
582
  s3.Bucket(self, "MyBucket",
620
583
  intelligent_tiering_configurations=[s3.IntelligentTieringConfiguration(
621
584
  name="foo",
622
585
  prefix="folder/name",
623
- archive_access_tier_time=cdk.Duration.days(90),
624
- deep_archive_access_tier_time=cdk.Duration.days(180),
586
+ archive_access_tier_time=Duration.days(90),
587
+ deep_archive_access_tier_time=Duration.days(180),
625
588
  tags=[s3.Tag(key="tagname", value="tagvalue")]
626
589
  )
627
590
  ]
@@ -633,22 +596,21 @@ s3.Bucket(self, "MyBucket",
633
596
  [Managing lifecycle](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) can be configured transition or expiration actions.
634
597
 
635
598
  ```python
636
- # Example automatically generated from non-compiling source. May contain errors.
637
599
  bucket = s3.Bucket(self, "MyBucket",
638
600
  lifecycle_rules=[s3.LifecycleRule(
639
- abort_incomplete_multipart_upload_after=cdk.Duration.minutes(30),
601
+ abort_incomplete_multipart_upload_after=Duration.minutes(30),
640
602
  enabled=False,
641
- expiration=cdk.Duration.days(30),
603
+ expiration=Duration.days(30),
642
604
  expiration_date=Date(),
643
605
  expired_object_delete_marker=False,
644
606
  id="id",
645
- noncurrent_version_expiration=cdk.Duration.days(30),
607
+ noncurrent_version_expiration=Duration.days(30),
646
608
 
647
609
  # the properties below are optional
648
610
  noncurrent_versions_to_retain=123,
649
611
  noncurrent_version_transitions=[s3.NoncurrentVersionTransition(
650
612
  storage_class=s3.StorageClass.GLACIER,
651
- transition_after=cdk.Duration.days(30),
613
+ transition_after=Duration.days(30),
652
614
 
653
615
  # the properties below are optional
654
616
  noncurrent_versions_to_retain=123
@@ -661,7 +623,7 @@ bucket = s3.Bucket(self, "MyBucket",
661
623
  storage_class=s3.StorageClass.GLACIER,
662
624
 
663
625
  # the properties below are optional
664
- transition_after=cdk.Duration.days(30),
626
+ transition_after=Duration.days(30),
665
627
  transition_date=Date()
666
628
  )
667
629
  ]
@@ -680,7 +642,6 @@ enabled later via the CDK.
680
642
  Object Lock can be enabled on an S3 bucket by specifying:
681
643
 
682
644
  ```python
683
- # Example automatically generated from non-compiling source. May contain errors.
684
645
  bucket = s3.Bucket(self, "MyBucket",
685
646
  object_lock_enabled=True
686
647
  )
@@ -692,15 +653,14 @@ and a [retention period](https://docs.aws.amazon.com/AmazonS3/latest/userguide/o
692
653
  These can be specified by providing `objectLockDefaultRetention`:
693
654
 
694
655
  ```python
695
- # Example automatically generated from non-compiling source. May contain errors.
696
656
  # Configure for governance mode with a duration of 7 years
697
657
  s3.Bucket(self, "Bucket1",
698
- object_lock_default_retention=s3.ObjectLockRetention.governance(cdk.Duration.days(7 * 365))
658
+ object_lock_default_retention=s3.ObjectLockRetention.governance(Duration.days(7 * 365))
699
659
  )
700
660
 
701
661
  # Configure for compliance mode with a duration of 1 year
702
662
  s3.Bucket(self, "Bucket2",
703
- object_lock_default_retention=s3.ObjectLockRetention.compliance(cdk.Duration.days(365))
663
+ object_lock_default_retention=s3.ObjectLockRetention.compliance(Duration.days(365))
704
664
  )
705
665
  ```
706
666
  '''
@@ -758,7 +718,6 @@ class BlockPublicAccess(
758
718
 
759
719
  Example::
760
720
 
761
- # Example automatically generated from non-compiling source. May contain errors.
762
721
  bucket = s3.Bucket(self, "MyBlockedBucket",
763
722
  block_public_access=s3.BlockPublicAccess.BLOCK_ALL
764
723
  )
@@ -875,7 +834,6 @@ class BlockPublicAccessOptions:
875
834
 
876
835
  Example::
877
836
 
878
- # Example automatically generated from non-compiling source. May contain errors.
879
837
  bucket = s3.Bucket(self, "MyBlockedBucket",
880
838
  block_public_access=s3.BlockPublicAccess(block_public_policy=True)
881
839
  )
@@ -1075,7 +1033,6 @@ class BucketAttributes:
1075
1033
 
1076
1034
  Example::
1077
1035
 
1078
- # Example automatically generated from non-compiling source. May contain errors.
1079
1036
  # my_lambda: lambda.Function
1080
1037
 
1081
1038
  bucket = s3.Bucket.from_bucket_attributes(self, "ImportedBucket",
@@ -1267,7 +1224,6 @@ class BucketEncryption(enum.Enum):
1267
1224
 
1268
1225
  Example::
1269
1226
 
1270
- # Example automatically generated from non-compiling source. May contain errors.
1271
1227
  bucket = s3.Bucket(self, "MyEncryptedBucket",
1272
1228
  encryption=s3.BucketEncryption.KMS
1273
1229
  )
@@ -1277,7 +1233,18 @@ class BucketEncryption(enum.Enum):
1277
1233
  '''
1278
1234
 
1279
1235
  UNENCRYPTED = "UNENCRYPTED"
1280
- '''Objects in the bucket are not encrypted.'''
1236
+ '''(deprecated) Previous option.
1237
+
1238
+ Buckets can not be unencrypted now.
1239
+
1240
+ :deprecated:
1241
+
1242
+ S3 applies server-side encryption with SSE-S3 for every bucket
1243
+ that default encryption is not configured.
1244
+
1245
+ :see: https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html
1246
+ :stability: deprecated
1247
+ '''
1281
1248
  KMS_MANAGED = "KMS_MANAGED"
1282
1249
  '''Server-side KMS encryption with a master key managed by KMS.'''
1283
1250
  S3_MANAGED = "S3_MANAGED"
@@ -1716,7 +1683,7 @@ class BucketProps:
1716
1683
  :param bucket_key_enabled: Whether Amazon S3 should use its own intermediary key to generate data keys. Only relevant when using KMS for encryption. - If not enabled, every object GET and PUT will cause an API call to KMS (with the attendant cost implications of that). - If enabled, S3 will use its own time-limited key instead. Only relevant, when Encryption is set to ``BucketEncryption.KMS`` or ``BucketEncryption.KMS_MANAGED``. Default: - false
1717
1684
  :param bucket_name: Physical name of this bucket. Default: - Assigned by CloudFormation (recommended).
1718
1685
  :param cors: The CORS configuration of this bucket. Default: - No CORS configuration.
1719
- :param encryption: The kind of server-side encryption to apply to this bucket. If you choose KMS, you can specify a KMS key via ``encryptionKey``. If encryption key is not specified, a key will automatically be created. Default: - ``Kms`` if ``encryptionKey`` is specified, or ``Unencrypted`` otherwise.
1686
+ :param encryption: The kind of server-side encryption to apply to this bucket. If you choose KMS, you can specify a KMS key via ``encryptionKey``. If encryption key is not specified, a key will automatically be created. Default: - ``Kms`` if ``encryptionKey`` is specified, or ``Managed`` otherwise.
1720
1687
  :param encryption_key: External KMS key to use for bucket encryption. The 'encryption' property must be either not specified or set to "Kms". An error will be emitted if encryption is set to "Unencrypted" or "Managed". Default: - If encryption is set to "Kms" and this property is undefined, a new KMS key will be created and associated with this bucket.
1721
1688
  :param enforce_ssl: Enforces SSL for requests. S3.5 of the AWS Foundational Security Best Practices Regarding S3. Default: false
1722
1689
  :param event_bridge_enabled: Whether this bucket should send notifications to Amazon EventBridge or not. Default: false
@@ -1743,7 +1710,6 @@ class BucketProps:
1743
1710
 
1744
1711
  Example::
1745
1712
 
1746
- # Example automatically generated from non-compiling source. May contain errors.
1747
1713
  source_bucket = s3.Bucket(self, "MyBucket",
1748
1714
  versioned=True
1749
1715
  )
@@ -1931,7 +1897,7 @@ class BucketProps:
1931
1897
  If you choose KMS, you can specify a KMS key via ``encryptionKey``. If
1932
1898
  encryption key is not specified, a key will automatically be created.
1933
1899
 
1934
- :default: - ``Kms`` if ``encryptionKey`` is specified, or ``Unencrypted`` otherwise.
1900
+ :default: - ``Kms`` if ``encryptionKey`` is specified, or ``Managed`` otherwise.
1935
1901
  '''
1936
1902
  result = self._values.get("encryption")
1937
1903
  return typing.cast(typing.Optional[BucketEncryption], result)
@@ -9347,7 +9313,6 @@ class CfnBucketProps:
9347
9313
 
9348
9314
  Example::
9349
9315
 
9350
- # Example automatically generated from non-compiling source. May contain errors.
9351
9316
  raw_bucket = s3.CfnBucket(self, "Bucket")
9352
9317
  # -or-
9353
9318
  raw_bucket_alt = my_bucket.node.default_child
@@ -12559,7 +12524,6 @@ class EventType(enum.Enum):
12559
12524
 
12560
12525
  Example::
12561
12526
 
12562
- # Example automatically generated from non-compiling source. May contain errors.
12563
12527
  # my_queue: sqs.Queue
12564
12528
 
12565
12529
  bucket = s3.Bucket(self, "MyBucket")
@@ -12836,7 +12800,6 @@ class IBucket(_IResource_c80c4260, typing_extensions.Protocol):
12836
12800
 
12837
12801
  Example::
12838
12802
 
12839
- # Example automatically generated from non-compiling source. May contain errors.
12840
12803
  # my_lambda: lambda.Function
12841
12804
 
12842
12805
  bucket = s3.Bucket(self, "MyBucket")
@@ -13352,7 +13315,6 @@ class _IBucketProxy(
13352
13315
 
13353
13316
  Example::
13354
13317
 
13355
- # Example automatically generated from non-compiling source. May contain errors.
13356
13318
  # my_lambda: lambda.Function
13357
13319
 
13358
13320
  bucket = s3.Bucket(self, "MyBucket")
@@ -14241,7 +14203,6 @@ class InventoryDestination:
14241
14203
 
14242
14204
  Example::
14243
14205
 
14244
- # Example automatically generated from non-compiling source. May contain errors.
14245
14206
  inventory_bucket = s3.Bucket(self, "InventoryBucket")
14246
14207
 
14247
14208
  data_bucket = s3.Bucket(self, "DataBucket",
@@ -14335,7 +14296,6 @@ class InventoryFrequency(enum.Enum):
14335
14296
 
14336
14297
  Example::
14337
14298
 
14338
- # Example automatically generated from non-compiling source. May contain errors.
14339
14299
  inventory_bucket = s3.Bucket(self, "InventoryBucket")
14340
14300
 
14341
14301
  data_bucket = s3.Bucket(self, "DataBucket",
@@ -14371,7 +14331,6 @@ class InventoryObjectVersion(enum.Enum):
14371
14331
 
14372
14332
  Example::
14373
14333
 
14374
- # Example automatically generated from non-compiling source. May contain errors.
14375
14334
  inventory_bucket = s3.Bucket(self, "InventoryBucket")
14376
14335
 
14377
14336
  data_bucket = s3.Bucket(self, "DataBucket",
@@ -15032,7 +14991,6 @@ class NotificationKeyFilter:
15032
14991
 
15033
14992
  Example::
15034
14993
 
15035
- # Example automatically generated from non-compiling source. May contain errors.
15036
14994
  # my_queue: sqs.Queue
15037
14995
 
15038
14996
  bucket = s3.Bucket(self, "MyBucket")
@@ -15110,15 +15068,14 @@ class ObjectLockRetention(
15110
15068
 
15111
15069
  Example::
15112
15070
 
15113
- # Example automatically generated from non-compiling source. May contain errors.
15114
15071
  # Configure for governance mode with a duration of 7 years
15115
15072
  s3.Bucket(self, "Bucket1",
15116
- object_lock_default_retention=s3.ObjectLockRetention.governance(cdk.Duration.days(7 * 365))
15073
+ object_lock_default_retention=s3.ObjectLockRetention.governance(Duration.days(7 * 365))
15117
15074
  )
15118
15075
 
15119
15076
  # Configure for compliance mode with a duration of 1 year
15120
15077
  s3.Bucket(self, "Bucket2",
15121
- object_lock_default_retention=s3.ObjectLockRetention.compliance(cdk.Duration.days(365))
15078
+ object_lock_default_retention=s3.ObjectLockRetention.compliance(Duration.days(365))
15122
15079
  )
15123
15080
  '''
15124
15081
 
@@ -15184,7 +15141,6 @@ class ObjectOwnership(enum.Enum):
15184
15141
 
15185
15142
  Example::
15186
15143
 
15187
- # Example automatically generated from non-compiling source. May contain errors.
15188
15144
  s3.Bucket(self, "MyBucket",
15189
15145
  object_ownership=s3.ObjectOwnership.OBJECT_WRITER
15190
15146
  )
@@ -15375,7 +15331,6 @@ class RedirectProtocol(enum.Enum):
15375
15331
 
15376
15332
  Example::
15377
15333
 
15378
- # Example automatically generated from non-compiling source. May contain errors.
15379
15334
  bucket = s3.Bucket(self, "MyRedirectedBucket",
15380
15335
  website_routing_rules=[s3.RoutingRule(
15381
15336
  host_name="www.example.com",
@@ -15416,7 +15371,6 @@ class RedirectTarget:
15416
15371
 
15417
15372
  Example::
15418
15373
 
15419
- # Example automatically generated from non-compiling source. May contain errors.
15420
15374
  bucket = s3.Bucket(self, "MyRedirectedBucket",
15421
15375
  website_redirect=s3.RedirectTarget(host_name="www.example.com")
15422
15376
  )
@@ -15465,7 +15419,6 @@ class ReplaceKey(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_s3.ReplaceK
15465
15419
 
15466
15420
  Example::
15467
15421
 
15468
- # Example automatically generated from non-compiling source. May contain errors.
15469
15422
  bucket = s3.Bucket(self, "MyRedirectedBucket",
15470
15423
  website_routing_rules=[s3.RoutingRule(
15471
15424
  host_name="www.example.com",
@@ -15668,7 +15621,6 @@ class RoutingRuleCondition:
15668
15621
 
15669
15622
  Example::
15670
15623
 
15671
- # Example automatically generated from non-compiling source. May contain errors.
15672
15624
  bucket = s3.Bucket(self, "MyRedirectedBucket",
15673
15625
  website_routing_rules=[s3.RoutingRule(
15674
15626
  host_name="www.example.com",
@@ -15739,22 +15691,21 @@ class StorageClass(
15739
15691
 
15740
15692
  Example::
15741
15693
 
15742
- # Example automatically generated from non-compiling source. May contain errors.
15743
15694
  bucket = s3.Bucket(self, "MyBucket",
15744
15695
  lifecycle_rules=[s3.LifecycleRule(
15745
- abort_incomplete_multipart_upload_after=cdk.Duration.minutes(30),
15696
+ abort_incomplete_multipart_upload_after=Duration.minutes(30),
15746
15697
  enabled=False,
15747
- expiration=cdk.Duration.days(30),
15698
+ expiration=Duration.days(30),
15748
15699
  expiration_date=Date(),
15749
15700
  expired_object_delete_marker=False,
15750
15701
  id="id",
15751
- noncurrent_version_expiration=cdk.Duration.days(30),
15702
+ noncurrent_version_expiration=Duration.days(30),
15752
15703
 
15753
15704
  # the properties below are optional
15754
15705
  noncurrent_versions_to_retain=123,
15755
15706
  noncurrent_version_transitions=[s3.NoncurrentVersionTransition(
15756
15707
  storage_class=s3.StorageClass.GLACIER,
15757
- transition_after=cdk.Duration.days(30),
15708
+ transition_after=Duration.days(30),
15758
15709
 
15759
15710
  # the properties below are optional
15760
15711
  noncurrent_versions_to_retain=123
@@ -15767,7 +15718,7 @@ class StorageClass(
15767
15718
  storage_class=s3.StorageClass.GLACIER,
15768
15719
 
15769
15720
  # the properties below are optional
15770
- transition_after=cdk.Duration.days(30),
15721
+ transition_after=Duration.days(30),
15771
15722
  transition_date=Date()
15772
15723
  )
15773
15724
  ]
@@ -16086,7 +16037,6 @@ class VirtualHostedStyleUrlOptions:
16086
16037
 
16087
16038
  Example::
16088
16039
 
16089
- # Example automatically generated from non-compiling source. May contain errors.
16090
16040
  bucket = s3.Bucket(self, "MyBucket")
16091
16041
  bucket.url_for_object("objectname") # Path-Style URL
16092
16042
  bucket.virtual_hosted_url_for_object("objectname") # Virtual Hosted-Style URL
@@ -16190,7 +16140,6 @@ class BucketBase(
16190
16140
 
16191
16141
  Example::
16192
16142
 
16193
- # Example automatically generated from non-compiling source. May contain errors.
16194
16143
  # my_lambda: lambda.Function
16195
16144
 
16196
16145
  bucket = s3.Bucket(self, "MyBucket")
@@ -16931,10 +16880,12 @@ class Bucket(
16931
16880
 
16932
16881
  Example::
16933
16882
 
16934
- # Example automatically generated from non-compiling source. May contain errors.
16935
- Bucket(scope, "Bucket",
16936
- block_public_access=BlockPublicAccess.BLOCK_ALL,
16937
- encryption=BucketEncryption.S3_MANAGED,
16883
+ from aws_cdk import RemovalPolicy
16884
+
16885
+
16886
+ s3.Bucket(scope, "Bucket",
16887
+ block_public_access=s3.BlockPublicAccess.BLOCK_ALL,
16888
+ encryption=s3.BucketEncryption.S3_MANAGED,
16938
16889
  enforce_sSL=True,
16939
16890
  versioned=True,
16940
16891
  removal_policy=RemovalPolicy.RETAIN
@@ -16984,7 +16935,7 @@ class Bucket(
16984
16935
  :param bucket_key_enabled: Whether Amazon S3 should use its own intermediary key to generate data keys. Only relevant when using KMS for encryption. - If not enabled, every object GET and PUT will cause an API call to KMS (with the attendant cost implications of that). - If enabled, S3 will use its own time-limited key instead. Only relevant, when Encryption is set to ``BucketEncryption.KMS`` or ``BucketEncryption.KMS_MANAGED``. Default: - false
16985
16936
  :param bucket_name: Physical name of this bucket. Default: - Assigned by CloudFormation (recommended).
16986
16937
  :param cors: The CORS configuration of this bucket. Default: - No CORS configuration.
16987
- :param encryption: The kind of server-side encryption to apply to this bucket. If you choose KMS, you can specify a KMS key via ``encryptionKey``. If encryption key is not specified, a key will automatically be created. Default: - ``Kms`` if ``encryptionKey`` is specified, or ``Unencrypted`` otherwise.
16938
+ :param encryption: The kind of server-side encryption to apply to this bucket. If you choose KMS, you can specify a KMS key via ``encryptionKey``. If encryption key is not specified, a key will automatically be created. Default: - ``Kms`` if ``encryptionKey`` is specified, or ``Managed`` otherwise.
16988
16939
  :param encryption_key: External KMS key to use for bucket encryption. The 'encryption' property must be either not specified or set to "Kms". An error will be emitted if encryption is set to "Unencrypted" or "Managed". Default: - If encryption is set to "Kms" and this property is undefined, a new KMS key will be created and associated with this bucket.
16989
16940
  :param enforce_ssl: Enforces SSL for requests. S3.5 of the AWS Foundational Security Best Practices Regarding S3. Default: false
16990
16941
  :param event_bridge_enabled: Whether this bucket should send notifications to Amazon EventBridge or not. Default: false
@@ -84,7 +84,6 @@ class LambdaDestination(
84
84
 
85
85
  Example::
86
86
 
87
- # Example automatically generated from non-compiling source. May contain errors.
88
87
  # my_lambda: lambda.Function
89
88
 
90
89
  bucket = s3.Bucket.from_bucket_attributes(self, "ImportedBucket",
@@ -139,7 +138,6 @@ class SnsDestination(
139
138
 
140
139
  Example::
141
140
 
142
- # Example automatically generated from non-compiling source. May contain errors.
143
141
  bucket = s3.Bucket(self, "MyBucket")
144
142
  topic = sns.Topic(self, "MyTopic")
145
143
  bucket.add_event_notification(s3.EventType.OBJECT_CREATED, s3n.SnsDestination(topic))
@@ -187,7 +185,6 @@ class SqsDestination(
187
185
 
188
186
  Example::
189
187
 
190
- # Example automatically generated from non-compiling source. May contain errors.
191
188
  # my_queue: sqs.Queue
192
189
 
193
190
  bucket = s3.Bucket(self, "MyBucket")