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.
- aws_cdk/__init__.py +245 -259
- aws_cdk/_jsii/__init__.py +1 -1
- aws_cdk/_jsii/{aws-cdk-lib@2.73.0.jsii.tgz → aws-cdk-lib@2.76.0.jsii.tgz} +0 -0
- aws_cdk/aws_amplifyuibuilder/__init__.py +182 -214
- aws_cdk/aws_apigateway/__init__.py +95 -148
- aws_cdk/aws_appconfig/__init__.py +8 -4
- aws_cdk/aws_appflow/__init__.py +27 -52
- aws_cdk/aws_appmesh/__init__.py +91 -200
- aws_cdk/aws_apprunner/__init__.py +4 -16
- aws_cdk/aws_appstream/__init__.py +18 -82
- aws_cdk/aws_athena/__init__.py +18 -32
- aws_cdk/aws_backup/__init__.py +48 -86
- aws_cdk/aws_batch/__init__.py +9 -2
- aws_cdk/aws_billingconductor/__init__.py +12 -7
- aws_cdk/aws_budgets/__init__.py +8 -17
- aws_cdk/aws_certificatemanager/__init__.py +7 -4
- aws_cdk/aws_cloudfront/__init__.py +14 -11
- aws_cdk/aws_cloudfront_origins/__init__.py +18 -8
- aws_cdk/aws_cloudtrail/__init__.py +7 -14
- aws_cdk/aws_cloudwatch/__init__.py +63 -35
- aws_cdk/aws_codebuild/__init__.py +10 -13
- aws_cdk/aws_codecommit/__init__.py +0 -1
- aws_cdk/aws_codedeploy/__init__.py +165 -162
- aws_cdk/aws_codegurureviewer/__init__.py +4 -4
- aws_cdk/aws_codepipeline/__init__.py +0 -4
- aws_cdk/aws_codepipeline_actions/__init__.py +16 -164
- aws_cdk/aws_cognito/__init__.py +195 -100
- aws_cdk/aws_config/__init__.py +28 -51
- aws_cdk/aws_connectcampaigns/__init__.py +5 -6
- aws_cdk/aws_databrew/__init__.py +5 -6
- aws_cdk/aws_dlm/__init__.py +33 -71
- aws_cdk/aws_docdb/__init__.py +20 -76
- aws_cdk/aws_dynamodb/__init__.py +29 -22
- aws_cdk/aws_ec2/__init__.py +2414 -603
- aws_cdk/aws_ecr/__init__.py +1 -2
- aws_cdk/aws_ecr_assets/__init__.py +27 -14
- aws_cdk/aws_ecs/__init__.py +458 -163
- aws_cdk/aws_ecs_patterns/__init__.py +13 -11
- aws_cdk/aws_eks/__init__.py +13 -8
- aws_cdk/aws_elasticloadbalancing/__init__.py +16 -9
- aws_cdk/aws_elasticloadbalancingv2/__init__.py +142 -82
- aws_cdk/aws_elasticloadbalancingv2_actions/__init__.py +126 -61
- aws_cdk/aws_elasticsearch/__init__.py +0 -7
- aws_cdk/aws_emr/__init__.py +7 -16
- aws_cdk/aws_emrserverless/__init__.py +14 -18
- aws_cdk/aws_events/__init__.py +33 -29
- aws_cdk/aws_events_targets/__init__.py +248 -89
- aws_cdk/aws_frauddetector/__init__.py +3 -4
- aws_cdk/aws_fsx/__init__.py +13 -7
- aws_cdk/aws_gamelift/__init__.py +11 -20
- aws_cdk/aws_grafana/__init__.py +4 -4
- aws_cdk/aws_iam/__init__.py +21 -25
- aws_cdk/aws_imagebuilder/__init__.py +58 -80
- aws_cdk/aws_internetmonitor/__init__.py +18 -10
- aws_cdk/aws_iot/__init__.py +16 -10
- aws_cdk/aws_iotcoredeviceadvisor/__init__.py +16 -26
- aws_cdk/aws_iotevents/__init__.py +6 -4
- aws_cdk/aws_iotfleetwise/__init__.py +27 -40
- aws_cdk/aws_iotsitewise/__init__.py +8 -5
- aws_cdk/aws_iotwireless/__init__.py +14 -9
- aws_cdk/aws_kinesisfirehose/__init__.py +21 -38
- aws_cdk/aws_lambda/__init__.py +76 -53
- aws_cdk/aws_lambda_event_sources/__init__.py +6 -21
- aws_cdk/aws_logs/__init__.py +5 -7
- aws_cdk/aws_macie/__init__.py +28 -23
- aws_cdk/aws_mediaconnect/__init__.py +5 -8
- aws_cdk/aws_mediaconvert/__init__.py +2 -2
- aws_cdk/aws_medialive/__init__.py +2 -4
- aws_cdk/aws_mediapackage/__init__.py +9 -18
- aws_cdk/aws_memorydb/__init__.py +5 -10
- aws_cdk/aws_mwaa/__init__.py +8 -4
- aws_cdk/aws_neptune/__init__.py +4 -4
- aws_cdk/aws_networkfirewall/__init__.py +8 -4
- aws_cdk/aws_networkmanager/__init__.py +4 -4
- aws_cdk/aws_nimblestudio/__init__.py +25 -45
- aws_cdk/aws_opensearchservice/__init__.py +0 -1
- aws_cdk/aws_panorama/__init__.py +11 -12
- aws_cdk/aws_personalize/__init__.py +46 -72
- aws_cdk/aws_pinpoint/__init__.py +36 -65
- aws_cdk/aws_quicksight/__init__.py +9972 -13374
- aws_cdk/aws_rds/__init__.py +53 -22
- aws_cdk/aws_route53/__init__.py +8 -16
- aws_cdk/aws_route53_targets/__init__.py +2 -4
- aws_cdk/aws_s3/__init__.py +41 -90
- aws_cdk/aws_s3_notifications/__init__.py +0 -3
- aws_cdk/aws_sagemaker/__init__.py +16 -10
- aws_cdk/aws_secretsmanager/__init__.py +17 -14
- aws_cdk/aws_servicecatalog/__init__.py +60 -83
- aws_cdk/aws_servicediscovery/__init__.py +4 -6
- aws_cdk/aws_ses/__init__.py +734 -28
- aws_cdk/aws_sns/__init__.py +4 -8
- aws_cdk/aws_ssm/__init__.py +19 -23
- aws_cdk/aws_ssmcontacts/__init__.py +10 -6
- aws_cdk/aws_ssmincidents/__init__.py +2 -1
- aws_cdk/aws_sso/__init__.py +4 -4
- aws_cdk/aws_stepfunctions/__init__.py +6 -15
- aws_cdk/aws_stepfunctions_tasks/__init__.py +51 -24
- aws_cdk/aws_timestream/__init__.py +22 -28
- aws_cdk/aws_transfer/__init__.py +188 -86
- aws_cdk/aws_wafv2/__init__.py +54 -38
- aws_cdk/aws_xray/__init__.py +15 -22
- aws_cdk/cloud_assembly_schema/__init__.py +14 -6
- aws_cdk/custom_resources/__init__.py +2 -3
- aws_cdk/pipelines/__init__.py +104 -134
- aws_cdk/triggers/__init__.py +46 -61
- {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/METADATA +47 -92
- {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/RECORD +111 -111
- {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/LICENSE +0 -0
- {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/NOTICE +0 -0
- {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/WHEEL +0 -0
- {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aws-cdk-lib
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.76.0
|
|
4
4
|
Summary: Version 2 of the AWS Cloud Development Kit library
|
|
5
5
|
Home-page: https://github.com/aws/aws-cdk
|
|
6
6
|
Author: Amazon Web Services
|
|
@@ -60,10 +60,8 @@ According to the kind of project you are developing:
|
|
|
60
60
|
You can use a classic import to get access to each service namespaces:
|
|
61
61
|
|
|
62
62
|
```python
|
|
63
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
64
63
|
from aws_cdk import Stack, App, aws_s3 as s3
|
|
65
64
|
|
|
66
|
-
|
|
67
65
|
app = App()
|
|
68
66
|
stack = Stack(app, "TestStack")
|
|
69
67
|
|
|
@@ -75,11 +73,9 @@ s3.Bucket(stack, "TestBucket")
|
|
|
75
73
|
Alternatively, you can use "barrel" imports:
|
|
76
74
|
|
|
77
75
|
```python
|
|
78
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
79
76
|
from aws_cdk import App, Stack
|
|
80
77
|
from aws_cdk.aws_s3 import Bucket
|
|
81
78
|
|
|
82
|
-
|
|
83
79
|
app = App()
|
|
84
80
|
stack = Stack(app, "TestStack")
|
|
85
81
|
|
|
@@ -153,7 +149,6 @@ Each of these synthesizers takes configuration arguments. To configure
|
|
|
153
149
|
a stack with a synthesizer, pass it as one of its properties:
|
|
154
150
|
|
|
155
151
|
```python
|
|
156
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
157
152
|
MyStack(app, "MyStack",
|
|
158
153
|
synthesizer=DefaultStackSynthesizer(
|
|
159
154
|
file_assets_bucket_name="my-orgs-asset-bucket"
|
|
@@ -175,7 +170,6 @@ For example, assume that you have a load balancer configuration that you use for
|
|
|
175
170
|
The following example will define a single top-level stack that contains two nested stacks: each one with a single Amazon S3 bucket:
|
|
176
171
|
|
|
177
172
|
```python
|
|
178
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
179
173
|
class MyNestedStack(cfn.NestedStack):
|
|
180
174
|
def __init__(self, scope, id, *, parameters=None, timeout=None, notifications=None):
|
|
181
175
|
super().__init__(scope, id, parameters=parameters, timeout=timeout, notifications=notifications)
|
|
@@ -207,7 +201,6 @@ which defines an Amazon S3 bucket. Then it defines a second stack, `stack2`,
|
|
|
207
201
|
which takes the bucket from stack1 as a constructor property.
|
|
208
202
|
|
|
209
203
|
```python
|
|
210
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
211
204
|
prod = {"account": "123456789012", "region": "us-east-1"}
|
|
212
205
|
|
|
213
206
|
stack1 = StackThatProvidesABucket(app, "Stack1", env=prod)
|
|
@@ -238,7 +231,6 @@ enabled it is possible to do something like creating a CloudFront distribution i
|
|
|
238
231
|
an ACM certificate in `us-east-1`.
|
|
239
232
|
|
|
240
233
|
```python
|
|
241
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
242
234
|
stack1 = Stack(app, "Stack1",
|
|
243
235
|
env=Environment(
|
|
244
236
|
region="us-east-1"
|
|
@@ -322,7 +314,6 @@ An instance of Duration is constructed by using one of the static factory
|
|
|
322
314
|
methods on it:
|
|
323
315
|
|
|
324
316
|
```python
|
|
325
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
326
317
|
Duration.seconds(300) # 5 minutes
|
|
327
318
|
Duration.minutes(5) # 5 minutes
|
|
328
319
|
Duration.hours(1) # 1 hour
|
|
@@ -333,7 +324,6 @@ Duration.parse("PT5M")
|
|
|
333
324
|
Durations can be added or subtracted together:
|
|
334
325
|
|
|
335
326
|
```python
|
|
336
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
337
327
|
Duration.minutes(1).plus(Duration.seconds(60)) # 2 minutes
|
|
338
328
|
Duration.minutes(5).minus(Duration.seconds(10))
|
|
339
329
|
```
|
|
@@ -346,7 +336,6 @@ To make specification of digital storage quantities unambiguous, a class called
|
|
|
346
336
|
An instance of `Size` is initialized through one of its static factory methods:
|
|
347
337
|
|
|
348
338
|
```python
|
|
349
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
350
339
|
Size.kibibytes(200) # 200 KiB
|
|
351
340
|
Size.mebibytes(5) # 5 MiB
|
|
352
341
|
Size.gibibytes(40) # 40 GiB
|
|
@@ -359,7 +348,6 @@ By default, conversion to a higher unit will fail if the conversion does not pro
|
|
|
359
348
|
a whole number. This can be overridden by unsetting `integral` property.
|
|
360
349
|
|
|
361
350
|
```python
|
|
362
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
363
351
|
Size.mebibytes(2).to_kibibytes() # yields 2048
|
|
364
352
|
Size.kibibytes(2050).to_mebibytes(rounding=SizeRoundingBehavior.FLOOR)
|
|
365
353
|
```
|
|
@@ -373,7 +361,6 @@ a password or an access key) will take a parameter of type `SecretValue`.
|
|
|
373
361
|
The best practice is to store secrets in AWS Secrets Manager and reference them using `SecretValue.secretsManager`:
|
|
374
362
|
|
|
375
363
|
```python
|
|
376
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
377
364
|
secret = SecretValue.secrets_manager("secretId",
|
|
378
365
|
json_field="password", # optional: key of a JSON field to retrieve (defaults to all content),
|
|
379
366
|
version_id="id", # optional: id of the version (default AWSCURRENT)
|
|
@@ -416,7 +403,6 @@ this purpose.
|
|
|
416
403
|
use the region and account of the stack you're calling it on:
|
|
417
404
|
|
|
418
405
|
```python
|
|
419
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
420
406
|
# stack: Stack
|
|
421
407
|
|
|
422
408
|
|
|
@@ -435,7 +421,6 @@ but in case of a deploy-time value be aware that the result will be another
|
|
|
435
421
|
deploy-time value which cannot be inspected in the CDK application.
|
|
436
422
|
|
|
437
423
|
```python
|
|
438
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
439
424
|
# stack: Stack
|
|
440
425
|
|
|
441
426
|
|
|
@@ -477,7 +462,6 @@ following creates a single object that represents a dependency on two
|
|
|
477
462
|
constructs, `constructB` and `constructC`:
|
|
478
463
|
|
|
479
464
|
```python
|
|
480
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
481
465
|
# Declare the dependable object
|
|
482
466
|
b_and_c = DependencyGroup()
|
|
483
467
|
b_and_c.add(construct_b)
|
|
@@ -530,7 +514,6 @@ of arbitrarily many custom resource definitions. A single definition looks like
|
|
|
530
514
|
this:
|
|
531
515
|
|
|
532
516
|
```python
|
|
533
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
534
517
|
CustomResource(self, "MyMagicalResource",
|
|
535
518
|
resource_type="Custom::MyCustomResource", # must start with 'Custom::'
|
|
536
519
|
|
|
@@ -584,7 +567,6 @@ Here is a basic pattern for defining stack singletons in the CDK. The following
|
|
|
584
567
|
examples ensures that only a single SNS topic is defined:
|
|
585
568
|
|
|
586
569
|
```python
|
|
587
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
588
570
|
def get_or_create(self, scope):
|
|
589
571
|
stack = Stack.of(scope)
|
|
590
572
|
uniqueid = "GloballyUniqueIdForSingleton" # For example, a UUID from `uuidgen`
|
|
@@ -610,7 +592,6 @@ CloudFormation service.
|
|
|
610
592
|
Set `serviceToken` to `topic.topicArn` in order to use this provider:
|
|
611
593
|
|
|
612
594
|
```python
|
|
613
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
614
595
|
topic = sns.Topic(self, "MyProvider")
|
|
615
596
|
|
|
616
597
|
CustomResource(self, "MyResource",
|
|
@@ -631,7 +612,6 @@ response to the CloudFormation service and handle various error cases.
|
|
|
631
612
|
Set `serviceToken` to `lambda.functionArn` to use this provider:
|
|
632
613
|
|
|
633
614
|
```python
|
|
634
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
635
615
|
fn = lambda_.Function(self, "MyProvider", function_props)
|
|
636
616
|
|
|
637
617
|
CustomResource(self, "MyResource",
|
|
@@ -656,7 +636,6 @@ The provider has a built-in singleton method which uses the resource type as a
|
|
|
656
636
|
stack-unique identifier and returns the service token:
|
|
657
637
|
|
|
658
638
|
```python
|
|
659
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
660
639
|
service_token = CustomResourceProvider.get_or_create(self, "Custom::MyCustomResourceType",
|
|
661
640
|
code_directory=f"{__dirname}/my-handler",
|
|
662
641
|
runtime=CustomResourceProviderRuntime.NODEJS_14_X,
|
|
@@ -732,8 +711,8 @@ exports.handler = async (e) => {
|
|
|
732
711
|
`sum.ts`:
|
|
733
712
|
|
|
734
713
|
```python
|
|
735
|
-
|
|
736
|
-
from aws_cdk
|
|
714
|
+
from constructs import Construct
|
|
715
|
+
from aws_cdk import CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Token
|
|
737
716
|
|
|
738
717
|
class Sum(Construct):
|
|
739
718
|
|
|
@@ -761,7 +740,6 @@ class Sum(Construct):
|
|
|
761
740
|
Usage will look like this:
|
|
762
741
|
|
|
763
742
|
```python
|
|
764
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
765
743
|
sum = Sum(self, "MySum", lhs=40, rhs=2)
|
|
766
744
|
CfnOutput(self, "Result", value=Token.as_string(sum.result))
|
|
767
745
|
```
|
|
@@ -770,7 +748,6 @@ To access the ARN of the provider's AWS Lambda function role, use the `getOrCrea
|
|
|
770
748
|
built-in singleton method:
|
|
771
749
|
|
|
772
750
|
```python
|
|
773
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
774
751
|
provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
|
|
775
752
|
code_directory=f"{__dirname}/my-handler",
|
|
776
753
|
runtime=CustomResourceProviderRuntime.NODEJS_14_X
|
|
@@ -784,7 +761,6 @@ This role ARN can then be used in resource-based IAM policies.
|
|
|
784
761
|
To add IAM policy statements to this role, use `addToRolePolicy()`:
|
|
785
762
|
|
|
786
763
|
```python
|
|
787
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
788
764
|
provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
|
|
789
765
|
code_directory=f"{__dirname}/my-handler",
|
|
790
766
|
runtime=CustomResourceProviderRuntime.NODEJS_14_X
|
|
@@ -813,7 +789,6 @@ allows implementing providers that can take up to two hours to stabilize.
|
|
|
813
789
|
Set `serviceToken` to `provider.serviceToken` to use this type of provider:
|
|
814
790
|
|
|
815
791
|
```python
|
|
816
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
817
792
|
provider = customresources.Provider(self, "MyProvider",
|
|
818
793
|
on_event_handler=on_event_handler,
|
|
819
794
|
is_complete_handler=is_complete_handler
|
|
@@ -838,7 +813,6 @@ CloudFormation [stack outputs](https://docs.aws.amazon.com/AWSCloudFormation/lat
|
|
|
838
813
|
the `CfnOutput` class:
|
|
839
814
|
|
|
840
815
|
```python
|
|
841
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
842
816
|
CfnOutput(self, "OutputName",
|
|
843
817
|
value=my_bucket.bucket_name,
|
|
844
818
|
description="The name of an S3 bucket", # Optional
|
|
@@ -858,7 +832,6 @@ stack to the AWS CDK).
|
|
|
858
832
|
Template parameters can be added to a stack by using the `CfnParameter` class:
|
|
859
833
|
|
|
860
834
|
```python
|
|
861
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
862
835
|
CfnParameter(self, "MyParameter",
|
|
863
836
|
type="Number",
|
|
864
837
|
default=1337
|
|
@@ -871,7 +844,6 @@ placeholder tokens for the real value (`Token.isUnresolved()` would return `true
|
|
|
871
844
|
for those):
|
|
872
845
|
|
|
873
846
|
```python
|
|
874
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
875
847
|
param = CfnParameter(self, "ParameterName")
|
|
876
848
|
|
|
877
849
|
# If the parameter is a String
|
|
@@ -895,7 +867,6 @@ instead, which guarantees the values produced are qualifying the designated
|
|
|
895
867
|
stack, which is essential in cases where resources are shared cross-stack:
|
|
896
868
|
|
|
897
869
|
```python
|
|
898
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
899
870
|
# "this" is the current construct
|
|
900
871
|
stack = Stack.of(self)
|
|
901
872
|
|
|
@@ -911,7 +882,6 @@ attributes](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-p
|
|
|
911
882
|
accessing those through the `cfnOptions` property:
|
|
912
883
|
|
|
913
884
|
```python
|
|
914
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
915
885
|
raw_bucket = s3.CfnBucket(self, "Bucket")
|
|
916
886
|
# -or-
|
|
917
887
|
raw_bucket_alt = my_bucket.node.default_child
|
|
@@ -927,7 +897,6 @@ Resource dependencies (the `DependsOn` attribute) is modified using the
|
|
|
927
897
|
`cfnResource.addDependency` method:
|
|
928
898
|
|
|
929
899
|
```python
|
|
930
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
931
900
|
resource_a = CfnResource(self, "ResourceA", resource_props)
|
|
932
901
|
resource_b = CfnResource(self, "ResourceB", resource_props)
|
|
933
902
|
|
|
@@ -945,18 +914,17 @@ a property of the creationPolicy on the resource options. Setting it to true wil
|
|
|
945
914
|
resources that depend on the fleet resource.
|
|
946
915
|
|
|
947
916
|
```python
|
|
948
|
-
|
|
949
|
-
fleet = CfnFleet(stack, "Fleet",
|
|
917
|
+
fleet = appstream.CfnFleet(self, "Fleet",
|
|
950
918
|
instance_type="stream.standard.small",
|
|
951
919
|
name="Fleet",
|
|
952
|
-
compute_capacity=
|
|
953
|
-
|
|
954
|
-
|
|
920
|
+
compute_capacity=appstream.CfnFleet.ComputeCapacityProperty(
|
|
921
|
+
desired_instances=1
|
|
922
|
+
),
|
|
955
923
|
image_name="AppStream-AmazonLinux2-09-21-2022"
|
|
956
924
|
)
|
|
957
|
-
fleet.cfn_options.creation_policy =
|
|
958
|
-
|
|
959
|
-
|
|
925
|
+
fleet.cfn_options.creation_policy = CfnCreationPolicy(
|
|
926
|
+
start_fleet=True
|
|
927
|
+
)
|
|
960
928
|
```
|
|
961
929
|
|
|
962
930
|
The properties passed to the level 2 constructs `AutoScalingGroup` and `Instance` from the
|
|
@@ -969,11 +937,15 @@ The format of the timeout is `PT#H#M#S`. In the example below AWS Cloudformation
|
|
|
969
937
|
`CREATE_COMPLETE`.
|
|
970
938
|
|
|
971
939
|
```python
|
|
972
|
-
#
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
940
|
+
# resource: CfnResource
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
resource.cfn_options.creation_policy = CfnCreationPolicy(
|
|
944
|
+
resource_signal=CfnResourceSignal(
|
|
945
|
+
count=3,
|
|
946
|
+
timeout="PR15M"
|
|
947
|
+
)
|
|
948
|
+
)
|
|
977
949
|
```
|
|
978
950
|
|
|
979
951
|
### Intrinsic Functions and Condition Expressions
|
|
@@ -983,7 +955,6 @@ can be accessed from the `Fn` class, which provides type-safe methods for each
|
|
|
983
955
|
intrinsic function as well as condition expressions:
|
|
984
956
|
|
|
985
957
|
```python
|
|
986
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
987
958
|
# my_object_or_array: Any
|
|
988
959
|
# my_array: Any
|
|
989
960
|
|
|
@@ -1013,7 +984,6 @@ needs to be expressed with un-resolved values, it is necessary to use
|
|
|
1013
984
|
CloudFormation conditions by means of the `CfnCondition` class:
|
|
1014
985
|
|
|
1015
986
|
```python
|
|
1016
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1017
987
|
environment_parameter = CfnParameter(self, "Environment")
|
|
1018
988
|
is_prod = CfnCondition(self, "IsProduction",
|
|
1019
989
|
expression=Fn.condition_equals("Production", environment_parameter)
|
|
@@ -1035,7 +1005,6 @@ CloudFormation [mappings](https://docs.aws.amazon.com/AWSCloudFormation/latest/U
|
|
|
1035
1005
|
`CfnMappings` class:
|
|
1036
1006
|
|
|
1037
1007
|
```python
|
|
1038
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1039
1008
|
region_table = CfnMapping(self, "RegionTable",
|
|
1040
1009
|
mapping={
|
|
1041
1010
|
"us-east-1": {
|
|
@@ -1071,7 +1040,6 @@ call to `findInMap` will be able to resolve the value during synthesis and simpl
|
|
|
1071
1040
|
`'US East (Ohio)'`.
|
|
1072
1041
|
|
|
1073
1042
|
```python
|
|
1074
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1075
1043
|
region_table = CfnMapping(self, "RegionTable",
|
|
1076
1044
|
mapping={
|
|
1077
1045
|
"us-east-1": {
|
|
@@ -1092,7 +1060,6 @@ since the top-level key is an unresolved token. The call to `findInMap` will ret
|
|
|
1092
1060
|
`{ "Fn::FindInMap": [ "RegionTable", { "Ref": "AWS::Region" }, "regionName" ] }`.
|
|
1093
1061
|
|
|
1094
1062
|
```python
|
|
1095
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1096
1063
|
# region_table: CfnMapping
|
|
1097
1064
|
|
|
1098
1065
|
|
|
@@ -1106,7 +1073,6 @@ for SSM parameters (including secure strings) and Secrets Manager. Encoding such
|
|
|
1106
1073
|
references is done using the `CfnDynamicReference` class:
|
|
1107
1074
|
|
|
1108
1075
|
```python
|
|
1109
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1110
1076
|
CfnDynamicReference(CfnDynamicReferenceService.SECRETS_MANAGER, "secret-id:secret-string:json-key:version-stage:version-id")
|
|
1111
1077
|
```
|
|
1112
1078
|
|
|
@@ -1117,7 +1083,6 @@ CloudFormation templates support a number of options, including which Macros or
|
|
|
1117
1083
|
configured using the `stack.templateOptions` property:
|
|
1118
1084
|
|
|
1119
1085
|
```python
|
|
1120
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1121
1086
|
stack = Stack(app, "StackName")
|
|
1122
1087
|
|
|
1123
1088
|
stack.template_options.description = "This will appear in the AWS console"
|
|
@@ -1133,7 +1098,6 @@ The `CfnResource` class allows emitting arbitrary entries in the
|
|
|
1133
1098
|
[Resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html) section of the CloudFormation template.
|
|
1134
1099
|
|
|
1135
1100
|
```python
|
|
1136
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1137
1101
|
CfnResource(self, "ResourceId",
|
|
1138
1102
|
type="AWS::S3::Bucket",
|
|
1139
1103
|
properties={
|
|
@@ -1153,7 +1117,6 @@ include fragments of an existing template verbatim in the synthesized template.
|
|
|
1153
1117
|
This can be achieved using the `CfnInclude` class.
|
|
1154
1118
|
|
|
1155
1119
|
```python
|
|
1156
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1157
1120
|
CfnInclude(self, "ID",
|
|
1158
1121
|
template={
|
|
1159
1122
|
"Resources": {
|
|
@@ -1178,7 +1141,6 @@ nested stacks belonging to that stack as well. You can enable termination protec
|
|
|
1178
1141
|
on a stack by setting the `terminationProtection` prop to `true`.
|
|
1179
1142
|
|
|
1180
1143
|
```python
|
|
1181
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1182
1144
|
stack = Stack(app, "StackName",
|
|
1183
1145
|
termination_protection=True
|
|
1184
1146
|
)
|
|
@@ -1191,7 +1153,6 @@ By default, termination protection is disabled.
|
|
|
1191
1153
|
You can add a description of the stack in the same way as `StackProps`.
|
|
1192
1154
|
|
|
1193
1155
|
```python
|
|
1194
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1195
1156
|
stack = Stack(app, "StackName",
|
|
1196
1157
|
description="This is a description."
|
|
1197
1158
|
)
|
|
@@ -1211,7 +1172,6 @@ The following example defines an IAM role which can only be assumed by
|
|
|
1211
1172
|
principals that are tagged with a specific tag.
|
|
1212
1173
|
|
|
1213
1174
|
```python
|
|
1214
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1215
1175
|
tag_param = CfnParameter(self, "TagName")
|
|
1216
1176
|
|
|
1217
1177
|
string_equals = CfnJson(self, "ConditionJson",
|
|
@@ -1262,7 +1222,6 @@ top take precedence over those below).
|
|
|
1262
1222
|
### Examples of setting context
|
|
1263
1223
|
|
|
1264
1224
|
```python
|
|
1265
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1266
1225
|
App(
|
|
1267
1226
|
context={
|
|
1268
1227
|
"@aws-cdk/core:newStyleStackSynthesis": True
|
|
@@ -1271,13 +1230,11 @@ App(
|
|
|
1271
1230
|
```
|
|
1272
1231
|
|
|
1273
1232
|
```python
|
|
1274
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1275
1233
|
app = App()
|
|
1276
1234
|
app.node.set_context("@aws-cdk/core:newStyleStackSynthesis", True)
|
|
1277
1235
|
```
|
|
1278
1236
|
|
|
1279
1237
|
```python
|
|
1280
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1281
1238
|
App(
|
|
1282
1239
|
post_cli_context={
|
|
1283
1240
|
"@aws-cdk/core:newStyleStackSynthesis": True
|
|
@@ -1324,10 +1281,6 @@ to all roles within a specific construct scope. The most common use case would
|
|
|
1324
1281
|
be to apply a permissions boundary at the `Stage` level.
|
|
1325
1282
|
|
|
1326
1283
|
```python
|
|
1327
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1328
|
-
# app: App
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
1284
|
prod_stage = Stage(app, "ProdStage",
|
|
1332
1285
|
permissions_boundary=PermissionsBoundary.from_name("cdk-${Qualifier}-PermissionsBoundary")
|
|
1333
1286
|
)
|
|
@@ -1360,11 +1313,10 @@ To use one or more validation plugins in your application, use the
|
|
|
1360
1313
|
`policyValidationBeta1` property of `Stage`:
|
|
1361
1314
|
|
|
1362
1315
|
```python
|
|
1363
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1364
1316
|
# globally for the entire app (an app is a stage)
|
|
1365
1317
|
app = App(
|
|
1366
1318
|
policy_validation_beta1=[
|
|
1367
|
-
# These hypothetical classes implement
|
|
1319
|
+
# These hypothetical classes implement IPolicyValidationPluginBeta1:
|
|
1368
1320
|
ThirdPartyPluginX(),
|
|
1369
1321
|
ThirdPartyPluginY()
|
|
1370
1322
|
]
|
|
@@ -1372,7 +1324,9 @@ app = App(
|
|
|
1372
1324
|
|
|
1373
1325
|
# only apply to a particular stage
|
|
1374
1326
|
prod_stage = Stage(app, "ProdStage",
|
|
1375
|
-
policy_validation_beta1=[
|
|
1327
|
+
policy_validation_beta1=[
|
|
1328
|
+
ThirdPartyPluginX()
|
|
1329
|
+
]
|
|
1376
1330
|
)
|
|
1377
1331
|
```
|
|
1378
1332
|
|
|
@@ -1392,7 +1346,6 @@ report in JSON format, enable it using the `@aws-cdk/core:validationReportJson`
|
|
|
1392
1346
|
context passing it directly to the application:
|
|
1393
1347
|
|
|
1394
1348
|
```python
|
|
1395
|
-
# Example automatically generated from non-compiling source. May contain errors.
|
|
1396
1349
|
app = App(
|
|
1397
1350
|
context={"@aws-cdk/core:validationReportJson": True}
|
|
1398
1351
|
)
|
|
@@ -1410,36 +1363,38 @@ the standard output.
|
|
|
1410
1363
|
### For plugin authors
|
|
1411
1364
|
|
|
1412
1365
|
The communication protocol between the CDK core module and your policy tool is
|
|
1413
|
-
defined by the `
|
|
1366
|
+
defined by the `IPolicyValidationPluginBeta1` interface. To create a new plugin you must
|
|
1414
1367
|
write a class that implements this interface. There are two things you need to
|
|
1415
1368
|
implement: the plugin name (by overriding the `name` property), and the
|
|
1416
1369
|
`validate()` method.
|
|
1417
1370
|
|
|
1418
|
-
The framework will call `validate()`, passing an `
|
|
1371
|
+
The framework will call `validate()`, passing an `IPolicyValidationContextBeta1` object.
|
|
1419
1372
|
The location of the templates to be validated is given by `templatePaths`. The
|
|
1420
|
-
plugin should return an instance of `
|
|
1373
|
+
plugin should return an instance of `PolicyValidationPluginReportBeta1`. This object
|
|
1421
1374
|
represents the report that the user wil receive at the end of the synthesis.
|
|
1422
1375
|
|
|
1423
1376
|
```python
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
"
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1377
|
+
@jsii.implements(IPolicyValidationPluginBeta1)
|
|
1378
|
+
class MyPlugin:
|
|
1379
|
+
|
|
1380
|
+
def validate(self, context):
|
|
1381
|
+
# First read the templates using context.templatePaths...
|
|
1382
|
+
|
|
1383
|
+
# ...then perform the validation, and then compose and return the report.
|
|
1384
|
+
# Using hard-coded values here for better clarity:
|
|
1385
|
+
return PolicyValidationPluginReportBeta1(
|
|
1386
|
+
success=False,
|
|
1387
|
+
violations=[PolicyViolationBeta1(
|
|
1388
|
+
rule_name="CKV_AWS_117",
|
|
1389
|
+
description="Ensure that AWS Lambda function is configured inside a VPC",
|
|
1390
|
+
fix="https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1",
|
|
1391
|
+
violating_resources=[PolicyViolatingResourceBeta1(
|
|
1392
|
+
resource_logical_id="MyFunction3BAA72D1",
|
|
1393
|
+
template_path="/home/johndoe/myapp/cdk.out/MyService.template.json",
|
|
1394
|
+
locations=["Properties/VpcConfig"]
|
|
1395
|
+
)]
|
|
1396
|
+
)]
|
|
1397
|
+
)
|
|
1443
1398
|
```
|
|
1444
1399
|
|
|
1445
1400
|
Note that plugins are not allowed to modify anything in the cloud assembly. Any
|