aws-cdk-lib 2.211.0__py3-none-any.whl → 2.212.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 +398 -43
- aws_cdk/_jsii/__init__.py +1 -1
- aws_cdk/_jsii/{aws-cdk-lib@2.211.0.jsii.tgz → aws-cdk-lib@2.212.0.jsii.tgz} +0 -0
- aws_cdk/aws_apigateway/__init__.py +2 -0
- aws_cdk/aws_apigatewayv2/__init__.py +1798 -74
- aws_cdk/aws_appintegrations/__init__.py +395 -0
- aws_cdk/aws_arcregionswitch/__init__.py +118 -0
- aws_cdk/aws_batch/__init__.py +4 -4
- aws_cdk/aws_bedrock/__init__.py +18 -0
- aws_cdk/aws_billingconductor/__init__.py +3 -3
- aws_cdk/aws_cloudfront/__init__.py +19 -0
- aws_cdk/aws_codebuild/__init__.py +122 -0
- aws_cdk/aws_codepipeline/__init__.py +51 -50
- aws_cdk/aws_connect/__init__.py +40 -15
- aws_cdk/aws_deadline/__init__.py +16 -5
- aws_cdk/aws_dynamodb/__init__.py +86 -16
- aws_cdk/aws_ec2/__init__.py +266 -55
- aws_cdk/aws_ecs/__init__.py +7 -9
- aws_cdk/aws_eks/__init__.py +6 -4
- aws_cdk/aws_elasticloadbalancingv2/__init__.py +2 -2
- aws_cdk/aws_gameliftstreams/__init__.py +7 -6
- aws_cdk/aws_glue/__init__.py +18 -9
- aws_cdk/aws_guardduty/__init__.py +1233 -113
- aws_cdk/aws_imagebuilder/__init__.py +34 -20
- aws_cdk/aws_inspectorv2/__init__.py +1516 -0
- aws_cdk/aws_ivs/__init__.py +1 -1
- aws_cdk/aws_lakeformation/__init__.py +1 -1
- aws_cdk/aws_lambda/__init__.py +6 -6
- aws_cdk/aws_omics/__init__.py +1 -1
- aws_cdk/aws_opensearchservice/__init__.py +128 -0
- aws_cdk/aws_pcs/__init__.py +16 -8
- aws_cdk/aws_quicksight/__init__.py +81 -83
- aws_cdk/aws_rds/__init__.py +31 -163
- aws_cdk/aws_s3express/__init__.py +7 -3
- aws_cdk/aws_s3tables/__init__.py +2 -2
- aws_cdk/aws_sagemaker/__init__.py +62 -20
- aws_cdk/aws_sqs/__init__.py +4 -3
- aws_cdk/aws_stepfunctions_tasks/__init__.py +16 -9
- aws_cdk/aws_synthetics/__init__.py +116 -0
- aws_cdk/cx_api/__init__.py +22 -0
- {aws_cdk_lib-2.211.0.dist-info → aws_cdk_lib-2.212.0.dist-info}/METADATA +329 -9
- {aws_cdk_lib-2.211.0.dist-info → aws_cdk_lib-2.212.0.dist-info}/RECORD +46 -46
- {aws_cdk_lib-2.211.0.dist-info → aws_cdk_lib-2.212.0.dist-info}/LICENSE +0 -0
- {aws_cdk_lib-2.211.0.dist-info → aws_cdk_lib-2.212.0.dist-info}/NOTICE +0 -0
- {aws_cdk_lib-2.211.0.dist-info → aws_cdk_lib-2.212.0.dist-info}/WHEEL +0 -0
- {aws_cdk_lib-2.211.0.dist-info → aws_cdk_lib-2.212.0.dist-info}/top_level.txt +0 -0
|
@@ -1474,6 +1474,12 @@ class CfnCanary(
|
|
|
1474
1474
|
handler="handler",
|
|
1475
1475
|
|
|
1476
1476
|
# the properties below are optional
|
|
1477
|
+
dependencies=[synthetics.CfnCanary.DependencyProperty(
|
|
1478
|
+
reference="reference",
|
|
1479
|
+
|
|
1480
|
+
# the properties below are optional
|
|
1481
|
+
type="type"
|
|
1482
|
+
)],
|
|
1477
1483
|
s3_bucket="s3Bucket",
|
|
1478
1484
|
s3_key="s3Key",
|
|
1479
1485
|
s3_object_version="s3ObjectVersion",
|
|
@@ -2120,6 +2126,7 @@ class CfnCanary(
|
|
|
2120
2126
|
jsii_struct_bases=[],
|
|
2121
2127
|
name_mapping={
|
|
2122
2128
|
"handler": "handler",
|
|
2129
|
+
"dependencies": "dependencies",
|
|
2123
2130
|
"s3_bucket": "s3Bucket",
|
|
2124
2131
|
"s3_key": "s3Key",
|
|
2125
2132
|
"s3_object_version": "s3ObjectVersion",
|
|
@@ -2132,6 +2139,7 @@ class CfnCanary(
|
|
|
2132
2139
|
self,
|
|
2133
2140
|
*,
|
|
2134
2141
|
handler: builtins.str,
|
|
2142
|
+
dependencies: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Sequence[typing.Union[_IResolvable_da3f097b, typing.Union["CfnCanary.DependencyProperty", typing.Dict[builtins.str, typing.Any]]]]]] = None,
|
|
2135
2143
|
s3_bucket: typing.Optional[builtins.str] = None,
|
|
2136
2144
|
s3_key: typing.Optional[builtins.str] = None,
|
|
2137
2145
|
s3_object_version: typing.Optional[builtins.str] = None,
|
|
@@ -2143,6 +2151,7 @@ class CfnCanary(
|
|
|
2143
2151
|
This structure contains the Lambda handler with the location where the canary should start running the script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included. If the script is passed into the canary directly, the script code is contained in the value of ``Script`` .
|
|
2144
2152
|
|
|
2145
2153
|
:param handler: The entry point to use for the source code when running the canary. For canaries that use the ``syn-python-selenium-1.0`` runtime or a ``syn-nodejs.puppeteer`` runtime earlier than ``syn-nodejs.puppeteer-3.4`` , the handler must be specified as ``*fileName* .handler`` . For ``syn-python-selenium-1.1`` , ``syn-nodejs.puppeteer-3.4`` , and later runtimes, the handler can be specified as ``*fileName* . *functionName*`` , or you can specify a folder where canary scripts reside as ``*folder* / *fileName* . *functionName*`` .
|
|
2154
|
+
:param dependencies: List of Lambda layers to attach to the canary.
|
|
2146
2155
|
:param s3_bucket: If your canary script is located in S3, specify the bucket name here. The bucket must already exist.
|
|
2147
2156
|
:param s3_key: The Amazon S3 key of your script. For more information, see `Working with Amazon S3 Objects <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingObjects.html>`_ .
|
|
2148
2157
|
:param s3_object_version: The Amazon S3 version ID of your script.
|
|
@@ -2162,6 +2171,12 @@ class CfnCanary(
|
|
|
2162
2171
|
handler="handler",
|
|
2163
2172
|
|
|
2164
2173
|
# the properties below are optional
|
|
2174
|
+
dependencies=[synthetics.CfnCanary.DependencyProperty(
|
|
2175
|
+
reference="reference",
|
|
2176
|
+
|
|
2177
|
+
# the properties below are optional
|
|
2178
|
+
type="type"
|
|
2179
|
+
)],
|
|
2165
2180
|
s3_bucket="s3Bucket",
|
|
2166
2181
|
s3_key="s3Key",
|
|
2167
2182
|
s3_object_version="s3ObjectVersion",
|
|
@@ -2172,6 +2187,7 @@ class CfnCanary(
|
|
|
2172
2187
|
if __debug__:
|
|
2173
2188
|
type_hints = typing.get_type_hints(_typecheckingstub__3d403372a613babc1ab10717d050ec9a7f4055961f3545f2d0600d89c7b3dcc3)
|
|
2174
2189
|
check_type(argname="argument handler", value=handler, expected_type=type_hints["handler"])
|
|
2190
|
+
check_type(argname="argument dependencies", value=dependencies, expected_type=type_hints["dependencies"])
|
|
2175
2191
|
check_type(argname="argument s3_bucket", value=s3_bucket, expected_type=type_hints["s3_bucket"])
|
|
2176
2192
|
check_type(argname="argument s3_key", value=s3_key, expected_type=type_hints["s3_key"])
|
|
2177
2193
|
check_type(argname="argument s3_object_version", value=s3_object_version, expected_type=type_hints["s3_object_version"])
|
|
@@ -2180,6 +2196,8 @@ class CfnCanary(
|
|
|
2180
2196
|
self._values: typing.Dict[builtins.str, typing.Any] = {
|
|
2181
2197
|
"handler": handler,
|
|
2182
2198
|
}
|
|
2199
|
+
if dependencies is not None:
|
|
2200
|
+
self._values["dependencies"] = dependencies
|
|
2183
2201
|
if s3_bucket is not None:
|
|
2184
2202
|
self._values["s3_bucket"] = s3_bucket
|
|
2185
2203
|
if s3_key is not None:
|
|
@@ -2203,6 +2221,17 @@ class CfnCanary(
|
|
|
2203
2221
|
assert result is not None, "Required property 'handler' is missing"
|
|
2204
2222
|
return typing.cast(builtins.str, result)
|
|
2205
2223
|
|
|
2224
|
+
@builtins.property
|
|
2225
|
+
def dependencies(
|
|
2226
|
+
self,
|
|
2227
|
+
) -> typing.Optional[typing.Union[_IResolvable_da3f097b, typing.List[typing.Union[_IResolvable_da3f097b, "CfnCanary.DependencyProperty"]]]]:
|
|
2228
|
+
'''List of Lambda layers to attach to the canary.
|
|
2229
|
+
|
|
2230
|
+
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html#cfn-synthetics-canary-code-dependencies
|
|
2231
|
+
'''
|
|
2232
|
+
result = self._values.get("dependencies")
|
|
2233
|
+
return typing.cast(typing.Optional[typing.Union[_IResolvable_da3f097b, typing.List[typing.Union[_IResolvable_da3f097b, "CfnCanary.DependencyProperty"]]]], result)
|
|
2234
|
+
|
|
2206
2235
|
@builtins.property
|
|
2207
2236
|
def s3_bucket(self) -> typing.Optional[builtins.str]:
|
|
2208
2237
|
'''If your canary script is located in S3, specify the bucket name here.
|
|
@@ -2265,6 +2294,78 @@ class CfnCanary(
|
|
|
2265
2294
|
k + "=" + repr(v) for k, v in self._values.items()
|
|
2266
2295
|
)
|
|
2267
2296
|
|
|
2297
|
+
@jsii.data_type(
|
|
2298
|
+
jsii_type="aws-cdk-lib.aws_synthetics.CfnCanary.DependencyProperty",
|
|
2299
|
+
jsii_struct_bases=[],
|
|
2300
|
+
name_mapping={"reference": "reference", "type": "type"},
|
|
2301
|
+
)
|
|
2302
|
+
class DependencyProperty:
|
|
2303
|
+
def __init__(
|
|
2304
|
+
self,
|
|
2305
|
+
*,
|
|
2306
|
+
reference: builtins.str,
|
|
2307
|
+
type: typing.Optional[builtins.str] = None,
|
|
2308
|
+
) -> None:
|
|
2309
|
+
'''
|
|
2310
|
+
:param reference: ARN of the Lambda layer.
|
|
2311
|
+
:param type: Type of dependency.
|
|
2312
|
+
|
|
2313
|
+
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-dependency.html
|
|
2314
|
+
:exampleMetadata: fixture=_generated
|
|
2315
|
+
|
|
2316
|
+
Example::
|
|
2317
|
+
|
|
2318
|
+
# The code below shows an example of how to instantiate this type.
|
|
2319
|
+
# The values are placeholders you should change.
|
|
2320
|
+
from aws_cdk import aws_synthetics as synthetics
|
|
2321
|
+
|
|
2322
|
+
dependency_property = synthetics.CfnCanary.DependencyProperty(
|
|
2323
|
+
reference="reference",
|
|
2324
|
+
|
|
2325
|
+
# the properties below are optional
|
|
2326
|
+
type="type"
|
|
2327
|
+
)
|
|
2328
|
+
'''
|
|
2329
|
+
if __debug__:
|
|
2330
|
+
type_hints = typing.get_type_hints(_typecheckingstub__02338e317b0b84f714774aabea98599cd96fe9cff23790733ad426e75f9984f4)
|
|
2331
|
+
check_type(argname="argument reference", value=reference, expected_type=type_hints["reference"])
|
|
2332
|
+
check_type(argname="argument type", value=type, expected_type=type_hints["type"])
|
|
2333
|
+
self._values: typing.Dict[builtins.str, typing.Any] = {
|
|
2334
|
+
"reference": reference,
|
|
2335
|
+
}
|
|
2336
|
+
if type is not None:
|
|
2337
|
+
self._values["type"] = type
|
|
2338
|
+
|
|
2339
|
+
@builtins.property
|
|
2340
|
+
def reference(self) -> builtins.str:
|
|
2341
|
+
'''ARN of the Lambda layer.
|
|
2342
|
+
|
|
2343
|
+
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-dependency.html#cfn-synthetics-canary-dependency-reference
|
|
2344
|
+
'''
|
|
2345
|
+
result = self._values.get("reference")
|
|
2346
|
+
assert result is not None, "Required property 'reference' is missing"
|
|
2347
|
+
return typing.cast(builtins.str, result)
|
|
2348
|
+
|
|
2349
|
+
@builtins.property
|
|
2350
|
+
def type(self) -> typing.Optional[builtins.str]:
|
|
2351
|
+
'''Type of dependency.
|
|
2352
|
+
|
|
2353
|
+
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-dependency.html#cfn-synthetics-canary-dependency-type
|
|
2354
|
+
'''
|
|
2355
|
+
result = self._values.get("type")
|
|
2356
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
2357
|
+
|
|
2358
|
+
def __eq__(self, rhs: typing.Any) -> builtins.bool:
|
|
2359
|
+
return isinstance(rhs, self.__class__) and rhs._values == self._values
|
|
2360
|
+
|
|
2361
|
+
def __ne__(self, rhs: typing.Any) -> builtins.bool:
|
|
2362
|
+
return not (rhs == self)
|
|
2363
|
+
|
|
2364
|
+
def __repr__(self) -> str:
|
|
2365
|
+
return "DependencyProperty(%s)" % ", ".join(
|
|
2366
|
+
k + "=" + repr(v) for k, v in self._values.items()
|
|
2367
|
+
)
|
|
2368
|
+
|
|
2268
2369
|
@jsii.data_type(
|
|
2269
2370
|
jsii_type="aws-cdk-lib.aws_synthetics.CfnCanary.RetryConfigProperty",
|
|
2270
2371
|
jsii_struct_bases=[],
|
|
@@ -2935,6 +3036,12 @@ class CfnCanaryProps:
|
|
|
2935
3036
|
handler="handler",
|
|
2936
3037
|
|
|
2937
3038
|
# the properties below are optional
|
|
3039
|
+
dependencies=[synthetics.CfnCanary.DependencyProperty(
|
|
3040
|
+
reference="reference",
|
|
3041
|
+
|
|
3042
|
+
# the properties below are optional
|
|
3043
|
+
type="type"
|
|
3044
|
+
)],
|
|
2938
3045
|
s3_bucket="s3Bucket",
|
|
2939
3046
|
s3_key="s3Key",
|
|
2940
3047
|
s3_object_version="s3ObjectVersion",
|
|
@@ -5173,6 +5280,7 @@ def _typecheckingstub__8d401a2416919aef18322e23fb875fc37ad8f90f34f8f5708a245f22f
|
|
|
5173
5280
|
def _typecheckingstub__3d403372a613babc1ab10717d050ec9a7f4055961f3545f2d0600d89c7b3dcc3(
|
|
5174
5281
|
*,
|
|
5175
5282
|
handler: builtins.str,
|
|
5283
|
+
dependencies: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Sequence[typing.Union[_IResolvable_da3f097b, typing.Union[CfnCanary.DependencyProperty, typing.Dict[builtins.str, typing.Any]]]]]] = None,
|
|
5176
5284
|
s3_bucket: typing.Optional[builtins.str] = None,
|
|
5177
5285
|
s3_key: typing.Optional[builtins.str] = None,
|
|
5178
5286
|
s3_object_version: typing.Optional[builtins.str] = None,
|
|
@@ -5182,6 +5290,14 @@ def _typecheckingstub__3d403372a613babc1ab10717d050ec9a7f4055961f3545f2d0600d89c
|
|
|
5182
5290
|
"""Type checking stubs"""
|
|
5183
5291
|
pass
|
|
5184
5292
|
|
|
5293
|
+
def _typecheckingstub__02338e317b0b84f714774aabea98599cd96fe9cff23790733ad426e75f9984f4(
|
|
5294
|
+
*,
|
|
5295
|
+
reference: builtins.str,
|
|
5296
|
+
type: typing.Optional[builtins.str] = None,
|
|
5297
|
+
) -> None:
|
|
5298
|
+
"""Type checking stubs"""
|
|
5299
|
+
pass
|
|
5300
|
+
|
|
5185
5301
|
def _typecheckingstub__e7a2c989ca2c701e49af0e8032c8c49bb52546c68c9e6359df8e7a9f2c4cf9a1(
|
|
5186
5302
|
*,
|
|
5187
5303
|
max_retries: jsii.Number,
|
aws_cdk/cx_api/__init__.py
CHANGED
|
@@ -765,6 +765,28 @@ When this feature flag is disabled, EgressOnlyGateway resource is created for al
|
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
767
|
```
|
|
768
|
+
|
|
769
|
+
* `@aws-cdk/aws-signer:signingProfileNamePassedToCfn`
|
|
770
|
+
|
|
771
|
+
When this feature flag is enabled, the `signingProfileName` property is passed to the L1 `CfnSigningProfile` construct,
|
|
772
|
+
which ensures that the AWS Signer profile is created with the specified name.
|
|
773
|
+
|
|
774
|
+
When this feature flag is disabled, the `signingProfileName` is not passed to CloudFormation, maintaining backward
|
|
775
|
+
compatibility with existing deployments where CloudFormation auto-generated profile names.
|
|
776
|
+
|
|
777
|
+
This feature flag is needed because enabling it can cause existing signing profiles to be
|
|
778
|
+
replaced during deployment if a `signingProfileName` was specified but not previously used
|
|
779
|
+
in the CloudFormation template.
|
|
780
|
+
|
|
781
|
+
*cdk.json*
|
|
782
|
+
|
|
783
|
+
```json
|
|
784
|
+
{
|
|
785
|
+
"context": {
|
|
786
|
+
"@aws-cdk/aws-signer:signingProfileNamePassedToCfn": true
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
```
|
|
768
790
|
'''
|
|
769
791
|
from pkgutil import extend_path
|
|
770
792
|
__path__ = extend_path(__path__, __name__)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aws-cdk-lib
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.212.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
|
|
@@ -22,7 +22,7 @@ License-File: LICENSE
|
|
|
22
22
|
License-File: NOTICE
|
|
23
23
|
Requires-Dist: aws-cdk.asset-awscli-v1 ==2.2.242
|
|
24
24
|
Requires-Dist: aws-cdk.asset-node-proxy-agent-v6 <3.0.0,>=2.1.0
|
|
25
|
-
Requires-Dist: aws-cdk.cloud-assembly-schema <49.0.0,>=48.
|
|
25
|
+
Requires-Dist: aws-cdk.cloud-assembly-schema <49.0.0,>=48.3.0
|
|
26
26
|
Requires-Dist: constructs <11.0.0,>=10.0.0
|
|
27
27
|
Requires-Dist: jsii <2.0.0,>=1.113.0
|
|
28
28
|
Requires-Dist: publication >=0.0.3
|
|
@@ -184,6 +184,76 @@ MyStack(app, "MyStack",
|
|
|
184
184
|
For more information on bootstrapping accounts and customizing synthesis,
|
|
185
185
|
see [Bootstrapping in the CDK Developer Guide](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html).
|
|
186
186
|
|
|
187
|
+
### STS Role Options
|
|
188
|
+
|
|
189
|
+
You can configure STS options that instruct the CDK CLI on which configuration should it use when assuming
|
|
190
|
+
the various roles that are involved in a deployment operation.
|
|
191
|
+
|
|
192
|
+
Refer to [the bootstrapping guide](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping-env.html#bootstrapping-env-roles) for further context.
|
|
193
|
+
|
|
194
|
+
These options are available via the `DefaultStackSynthesizer` properties:
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
class MyStack(Stack):
|
|
198
|
+
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, notificationArns=None, synthesizer=None, terminationProtection=None, analyticsReporting=None, crossRegionReferences=None, permissionsBoundary=None, suppressTemplateIndentation=None, propertyInjectors=None):
|
|
199
|
+
super().__init__(scope, id,
|
|
200
|
+
(SpreadAssignment ...props
|
|
201
|
+
description=description, env=env, stackName=stackName, tags=tags, notificationArns=notificationArns, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting, crossRegionReferences=crossRegionReferences, permissionsBoundary=permissionsBoundary, suppressTemplateIndentation=suppressTemplateIndentation, propertyInjectors=propertyInjectors),
|
|
202
|
+
synthesizer=DefaultStackSynthesizer(
|
|
203
|
+
deploy_role_external_id="",
|
|
204
|
+
deploy_role_additional_options={},
|
|
205
|
+
file_asset_publishing_external_id="",
|
|
206
|
+
file_asset_publishing_role_additional_options={},
|
|
207
|
+
image_asset_publishing_external_id="",
|
|
208
|
+
image_asset_publishing_role_additional_options={},
|
|
209
|
+
lookup_role_external_id="",
|
|
210
|
+
lookup_role_additional_options={}
|
|
211
|
+
)
|
|
212
|
+
)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
> Note that the `*additionalOptions` property does not allow passing `ExternalId` or `RoleArn`, as these options
|
|
216
|
+
> have dedicated properties that configure them.
|
|
217
|
+
|
|
218
|
+
#### Session Tags
|
|
219
|
+
|
|
220
|
+
STS session tags are used to implement [Attribute-Based Access Control](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html) (ABAC).
|
|
221
|
+
|
|
222
|
+
See [IAM tutorial: Define permissions to access AWS resources based on tags](https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html).
|
|
223
|
+
|
|
224
|
+
You can pass session tags for each [role created during bootstrap](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping-env.html#bootstrapping-env-roles) via the `*additionalOptions` property:
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
class MyStack(Stack):
|
|
228
|
+
def __init__(self, parent, id, *, description=None, env=None, stackName=None, tags=None, notificationArns=None, synthesizer=None, terminationProtection=None, analyticsReporting=None, crossRegionReferences=None, permissionsBoundary=None, suppressTemplateIndentation=None, propertyInjectors=None):
|
|
229
|
+
super().__init__(parent, id,
|
|
230
|
+
(SpreadAssignment ...props
|
|
231
|
+
description=description, env=env, stackName=stackName, tags=tags, notificationArns=notificationArns, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting, crossRegionReferences=crossRegionReferences, permissionsBoundary=permissionsBoundary, suppressTemplateIndentation=suppressTemplateIndentation, propertyInjectors=propertyInjectors),
|
|
232
|
+
synthesizer=DefaultStackSynthesizer(
|
|
233
|
+
deploy_role_additional_options={
|
|
234
|
+
"Tags": [{"Key": "Department", "Value": "Engineering"}]
|
|
235
|
+
},
|
|
236
|
+
file_asset_publishing_role_additional_options={
|
|
237
|
+
"Tags": [{"Key": "Department", "Value": "Engineering"}]
|
|
238
|
+
},
|
|
239
|
+
image_asset_publishing_role_additional_options={
|
|
240
|
+
"Tags": [{"Key": "Department", "Value": "Engineering"}]
|
|
241
|
+
},
|
|
242
|
+
lookup_role_additional_options={
|
|
243
|
+
"Tags": [{"Key": "Department", "Value": "Engineering"}]
|
|
244
|
+
}
|
|
245
|
+
)
|
|
246
|
+
)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
This will cause the CDK CLI to include session tags when assuming each of these roles during deployment.
|
|
250
|
+
Note that the trust policy of the role must contain permissions for the `sts:TagSession` action.
|
|
251
|
+
|
|
252
|
+
Refer to the [IAM user guide on session tags](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_permissions-required).
|
|
253
|
+
|
|
254
|
+
* If you are using a custom bootstrap template, make sure the template includes these permissions.
|
|
255
|
+
* If you are using the default bootstrap template from a CDK version lower than XXXX, you will need to rebootstrap your enviroment (once).
|
|
256
|
+
|
|
187
257
|
## Nested Stacks
|
|
188
258
|
|
|
189
259
|
[Nested stacks](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html) are stacks created as part of other stacks. You create a nested stack within another stack by using the `NestedStack` construct.
|
|
@@ -550,6 +620,8 @@ CustomResource(self, "MyMagicalResource",
|
|
|
550
620
|
resource_type="Custom::MyCustomResource", # must start with 'Custom::'
|
|
551
621
|
|
|
552
622
|
# the resource properties
|
|
623
|
+
# properties like serviceToken or serviceTimeout are ported into properties automatically
|
|
624
|
+
# try not to use key names similar to these or there will be a risk of overwriting those values
|
|
553
625
|
properties={
|
|
554
626
|
"Property1": "foo",
|
|
555
627
|
"Property2": "bar"
|
|
@@ -558,7 +630,10 @@ CustomResource(self, "MyMagicalResource",
|
|
|
558
630
|
# the ARN of the provider (SNS/Lambda) which handles
|
|
559
631
|
# CREATE, UPDATE or DELETE events for this resource type
|
|
560
632
|
# see next section for details
|
|
561
|
-
service_token="ARN"
|
|
633
|
+
service_token="ARN",
|
|
634
|
+
|
|
635
|
+
# the maximum time, in seconds, that can elapse before a custom resource operation times out.
|
|
636
|
+
service_timeout=Duration.seconds(60)
|
|
562
637
|
)
|
|
563
638
|
```
|
|
564
639
|
|
|
@@ -588,7 +663,7 @@ Legend:
|
|
|
588
663
|
* **Language**: which programming languages can be used to implement handlers.
|
|
589
664
|
* **Footprint**: how many resources are used by the provider framework itself.
|
|
590
665
|
|
|
591
|
-
|
|
666
|
+
#### A note about singletons
|
|
592
667
|
|
|
593
668
|
When defining resources for a custom resource provider, you will likely want to
|
|
594
669
|
define them as a *stack singleton* so that only a single instance of the
|
|
@@ -853,6 +928,18 @@ CfnOutput(self, "OutputName",
|
|
|
853
928
|
)
|
|
854
929
|
```
|
|
855
930
|
|
|
931
|
+
You can also use the `exportValue` method to export values as stack outputs:
|
|
932
|
+
|
|
933
|
+
```python
|
|
934
|
+
# stack: Stack
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
stack.export_value(my_bucket.bucket_name,
|
|
938
|
+
name="TheAwesomeBucket",
|
|
939
|
+
description="The name of an S3 bucket"
|
|
940
|
+
)
|
|
941
|
+
```
|
|
942
|
+
|
|
856
943
|
### Parameters
|
|
857
944
|
|
|
858
945
|
CloudFormation templates support the use of [Parameters](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html) to
|
|
@@ -1134,6 +1221,74 @@ references is done using the `CfnDynamicReference` class:
|
|
|
1134
1221
|
CfnDynamicReference(CfnDynamicReferenceService.SECRETS_MANAGER, "secret-id:secret-string:json-key:version-stage:version-id")
|
|
1135
1222
|
```
|
|
1136
1223
|
|
|
1224
|
+
## RemovalPolicies
|
|
1225
|
+
|
|
1226
|
+
The `RemovalPolicies` class provides a convenient way to manage removal policies for AWS CDK resources within a construct scope. It allows you to apply removal policies to multiple resources at once, with options to include or exclude specific resource types.
|
|
1227
|
+
|
|
1228
|
+
```python
|
|
1229
|
+
# scope: Construct
|
|
1230
|
+
# parent: Construct
|
|
1231
|
+
# bucket: s3.CfnBucket
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
# Apply DESTROY policy to all resources in a scope
|
|
1235
|
+
RemovalPolicies.of(scope).destroy()
|
|
1236
|
+
|
|
1237
|
+
# Apply RETAIN policy to all resources in a scope
|
|
1238
|
+
RemovalPolicies.of(scope).retain()
|
|
1239
|
+
|
|
1240
|
+
# Apply SNAPSHOT policy to all resources in a scope
|
|
1241
|
+
RemovalPolicies.of(scope).snapshot()
|
|
1242
|
+
|
|
1243
|
+
# Apply RETAIN_ON_UPDATE_OR_DELETE policy to all resources in a scope
|
|
1244
|
+
RemovalPolicies.of(scope).retain_on_update_or_delete()
|
|
1245
|
+
|
|
1246
|
+
# Apply RETAIN policy only to specific resource types
|
|
1247
|
+
RemovalPolicies.of(parent).retain(
|
|
1248
|
+
apply_to_resource_types=["AWS::DynamoDB::Table", bucket.cfn_resource_type, rds.CfnDBInstance.CFN_RESOURCE_TYPE_NAME
|
|
1249
|
+
]
|
|
1250
|
+
)
|
|
1251
|
+
|
|
1252
|
+
# Apply SNAPSHOT policy excluding specific resource types
|
|
1253
|
+
RemovalPolicies.of(scope).snapshot(
|
|
1254
|
+
exclude_resource_types=["AWS::Test::Resource"]
|
|
1255
|
+
)
|
|
1256
|
+
```
|
|
1257
|
+
|
|
1258
|
+
### RemovalPolicies vs MissingRemovalPolicies
|
|
1259
|
+
|
|
1260
|
+
CDK provides two different classes for managing removal policies:
|
|
1261
|
+
|
|
1262
|
+
* RemovalPolicies: Always applies the specified removal policy, overriding any existing policies.
|
|
1263
|
+
* MissingRemovalPolicies: Applies the removal policy only to resources that don't already have a policy set.
|
|
1264
|
+
|
|
1265
|
+
```python
|
|
1266
|
+
# Override any existing policies
|
|
1267
|
+
RemovalPolicies.of(scope).retain()
|
|
1268
|
+
|
|
1269
|
+
# Only apply to resources without existing policies
|
|
1270
|
+
MissingRemovalPolicies.of(scope).retain()
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
### Aspect Priority
|
|
1274
|
+
|
|
1275
|
+
Both RemovalPolicies and MissingRemovalPolicies are implemented as [Aspects](#aspects). You can control the order in which they're applied using the priority parameter:
|
|
1276
|
+
|
|
1277
|
+
```python
|
|
1278
|
+
# stack: Stack
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
# Apply in a specific order based on priority
|
|
1282
|
+
RemovalPolicies.of(stack).retain(priority=100)
|
|
1283
|
+
RemovalPolicies.of(stack).destroy(priority=200)
|
|
1284
|
+
```
|
|
1285
|
+
|
|
1286
|
+
For RemovalPolicies, the policies are applied in order of aspect execution, with the last applied policy overriding previous ones. The priority only affects the order in which aspects are applied during synthesis.
|
|
1287
|
+
|
|
1288
|
+
#### Note
|
|
1289
|
+
|
|
1290
|
+
When using MissingRemovalPolicies with priority, a warning will be issued as this can lead to unexpected behavior. This is because MissingRemovalPolicies only applies to resources without existing policies, making priority less relevant.
|
|
1291
|
+
|
|
1137
1292
|
### Template Options & Transform
|
|
1138
1293
|
|
|
1139
1294
|
CloudFormation templates support a number of options, including which Macros or
|
|
@@ -1223,6 +1378,27 @@ stack = Stack(app, "StackName",
|
|
|
1223
1378
|
)
|
|
1224
1379
|
```
|
|
1225
1380
|
|
|
1381
|
+
### Receiving CloudFormation Stack Events
|
|
1382
|
+
|
|
1383
|
+
You can add one or more SNS Topic ARNs to any Stack:
|
|
1384
|
+
|
|
1385
|
+
```python
|
|
1386
|
+
stack = Stack(app, "StackName",
|
|
1387
|
+
notification_arns=["arn:aws:sns:us-east-1:123456789012:Topic"]
|
|
1388
|
+
)
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
Stack events will be sent to any SNS Topics in this list. These ARNs are added to those specified using
|
|
1392
|
+
the `--notification-arns` command line option.
|
|
1393
|
+
|
|
1394
|
+
Note that in order to do delete notification ARNs entirely, you must pass an empty array ([]) instead of omitting it.
|
|
1395
|
+
If you omit the property, no action on existing ARNs will take place.
|
|
1396
|
+
|
|
1397
|
+
> [!NOTE]
|
|
1398
|
+
> Adding the `notificationArns` property (or using the `--notification-arns` CLI options) will **override**
|
|
1399
|
+
> any existing ARNs configured on the stack. If you have an external system managing notification ARNs,
|
|
1400
|
+
> either migrate to use this mechanism, or avoid specfying notification ARNs with the CDK.
|
|
1401
|
+
|
|
1226
1402
|
### CfnJson
|
|
1227
1403
|
|
|
1228
1404
|
`CfnJson` allows you to postpone the resolution of a JSON blob from
|
|
@@ -1325,7 +1501,7 @@ App(
|
|
|
1325
1501
|
cdk synth --context @aws-cdk/core:newStyleStackSynthesis=true
|
|
1326
1502
|
```
|
|
1327
1503
|
|
|
1328
|
-
|
|
1504
|
+
#### `cdk.json`
|
|
1329
1505
|
|
|
1330
1506
|
```json
|
|
1331
1507
|
{
|
|
@@ -1335,7 +1511,7 @@ cdk synth --context @aws-cdk/core:newStyleStackSynthesis=true
|
|
|
1335
1511
|
}
|
|
1336
1512
|
```
|
|
1337
1513
|
|
|
1338
|
-
|
|
1514
|
+
#### `cdk.context.json`
|
|
1339
1515
|
|
|
1340
1516
|
```json
|
|
1341
1517
|
{
|
|
@@ -1343,7 +1519,7 @@ cdk synth --context @aws-cdk/core:newStyleStackSynthesis=true
|
|
|
1343
1519
|
}
|
|
1344
1520
|
```
|
|
1345
1521
|
|
|
1346
|
-
|
|
1522
|
+
#### `~/.cdk.json`
|
|
1347
1523
|
|
|
1348
1524
|
```json
|
|
1349
1525
|
{
|
|
@@ -1382,7 +1558,7 @@ generated CloudFormation templates against your policies immediately after
|
|
|
1382
1558
|
synthesis. If there are any violations, the synthesis will fail and a report
|
|
1383
1559
|
will be printed to the console or to a file (see below).
|
|
1384
1560
|
|
|
1385
|
-
>
|
|
1561
|
+
> [!NOTE]
|
|
1386
1562
|
> This feature is considered experimental, and both the plugin API and the
|
|
1387
1563
|
> format of the validation report are subject to change in the future.
|
|
1388
1564
|
|
|
@@ -1420,7 +1596,7 @@ validation.
|
|
|
1420
1596
|
> etc. It's your responsibility as the consumer of a plugin to verify that it is
|
|
1421
1597
|
> secure to use.
|
|
1422
1598
|
|
|
1423
|
-
By default, the report will be printed in a human
|
|
1599
|
+
By default, the report will be printed in a human-readable format. If you want a
|
|
1424
1600
|
report in JSON format, enable it using the `@aws-cdk/core:validationReportJson`
|
|
1425
1601
|
context passing it directly to the application:
|
|
1426
1602
|
|
|
@@ -1434,6 +1610,18 @@ Alternatively, you can set this context key-value pair using the `cdk.json` or
|
|
|
1434
1610
|
`cdk.context.json` files in your project directory (see
|
|
1435
1611
|
[Runtime context](https://docs.aws.amazon.com/cdk/v2/guide/context.html)).
|
|
1436
1612
|
|
|
1613
|
+
It is also possible to enable both JSON and human-readable formats by setting
|
|
1614
|
+
`@aws-cdk/core:validationReportPrettyPrint` context key explicitly:
|
|
1615
|
+
|
|
1616
|
+
```python
|
|
1617
|
+
app = App(
|
|
1618
|
+
context={
|
|
1619
|
+
"@aws-cdk/core:validationReportJson": True,
|
|
1620
|
+
"@aws-cdk/core:validationReportPrettyPrint": True
|
|
1621
|
+
}
|
|
1622
|
+
)
|
|
1623
|
+
```
|
|
1624
|
+
|
|
1437
1625
|
If you choose the JSON format, the CDK will print the policy validation report
|
|
1438
1626
|
to a file called `policy-validation-report.json` in the cloud assembly
|
|
1439
1627
|
directory. For the default, human-readable format, the report will be printed to
|
|
@@ -1528,6 +1716,138 @@ warning by the `id`.
|
|
|
1528
1716
|
Annotations.of(self).acknowledge_warning("IAM:Group:MaxPoliciesExceeded", "Account has quota increased to 20")
|
|
1529
1717
|
```
|
|
1530
1718
|
|
|
1719
|
+
### Acknowledging Infos
|
|
1720
|
+
|
|
1721
|
+
Informational messages can also be emitted and acknowledged. Use `addInfoV2()`
|
|
1722
|
+
to add an info message that can later be suppressed with `acknowledgeInfo()`.
|
|
1723
|
+
Unlike warnings, info messages are not affected by the `--strict` mode and will never cause synthesis to fail.
|
|
1724
|
+
|
|
1725
|
+
```python
|
|
1726
|
+
Annotations.of(self).add_info_v2("my-lib:Construct.someInfo", "Some message explaining the info")
|
|
1727
|
+
Annotations.of(self).acknowledge_info("my-lib:Construct.someInfo", "This info can be ignored")
|
|
1728
|
+
```
|
|
1729
|
+
|
|
1730
|
+
## Aspects
|
|
1731
|
+
|
|
1732
|
+
[Aspects](https://docs.aws.amazon.com/cdk/v2/guide/aspects.html) is a feature in CDK that allows you to apply operations or transformations across all
|
|
1733
|
+
constructs in a construct tree. Common use cases include tagging resources, enforcing encryption on S3 Buckets, or applying specific security or
|
|
1734
|
+
compliance rules to all resources in a stack.
|
|
1735
|
+
|
|
1736
|
+
Conceptually, there are two types of Aspects:
|
|
1737
|
+
|
|
1738
|
+
* **Read-only aspects** scan the construct tree but do not make changes to the tree. Common use cases of read-only aspects include performing validations
|
|
1739
|
+
(for example, enforcing that all S3 Buckets have versioning enabled) and logging (for example, collecting information about all deployed resources for
|
|
1740
|
+
audits or compliance).
|
|
1741
|
+
* **Mutating aspects** either (1.) add new nodes or (2.) mutate existing nodes of the tree in-place. One commonly used mutating Aspect is adding Tags to
|
|
1742
|
+
resources. An example of an Aspect that adds a node is one that automatically adds a security group to every EC2 instance in the construct tree if
|
|
1743
|
+
no default is specified.
|
|
1744
|
+
|
|
1745
|
+
Here is a simple example of creating and applying an Aspect on a Stack to enable versioning on all S3 Buckets:
|
|
1746
|
+
|
|
1747
|
+
```python
|
|
1748
|
+
@jsii.implements(IAspect)
|
|
1749
|
+
class EnableBucketVersioning:
|
|
1750
|
+
def visit(self, node):
|
|
1751
|
+
if node instanceof s3.CfnBucket:
|
|
1752
|
+
node.versioning_configuration = s3.CfnBucket.VersioningConfigurationProperty(
|
|
1753
|
+
status="Enabled"
|
|
1754
|
+
)
|
|
1755
|
+
|
|
1756
|
+
app = App()
|
|
1757
|
+
stack = MyStack(app, "MyStack")
|
|
1758
|
+
|
|
1759
|
+
# Apply the aspect to enable versioning on all S3 Buckets
|
|
1760
|
+
Aspects.of(stack).add(EnableBucketVersioning())
|
|
1761
|
+
```
|
|
1762
|
+
|
|
1763
|
+
### Aspect Stabilization
|
|
1764
|
+
|
|
1765
|
+
The modern behavior is that Aspects automatically run on newly added nodes to the construct tree. This is controlled by the
|
|
1766
|
+
flag `@aws-cdk/core:aspectStabilization`, which is default for new projects (since version 2.172.0).
|
|
1767
|
+
|
|
1768
|
+
The old behavior of Aspects (without stabilization) was that Aspect invocation runs once on the entire construct
|
|
1769
|
+
tree. This meant that nested Aspects (Aspects that create new Aspects) are not invoked and nodes created by Aspects at a higher level of the construct tree are not visited.
|
|
1770
|
+
|
|
1771
|
+
To enable the stabilization behavior for older versions, use this feature by putting the following into your `cdk.context.json`:
|
|
1772
|
+
|
|
1773
|
+
```json
|
|
1774
|
+
{
|
|
1775
|
+
"@aws-cdk/core:aspectStabilization": true
|
|
1776
|
+
}
|
|
1777
|
+
```
|
|
1778
|
+
|
|
1779
|
+
### Aspect Priorities
|
|
1780
|
+
|
|
1781
|
+
Users can specify the order in which Aspects are applied on a construct by using the optional priority parameter when applying an Aspect. Priority
|
|
1782
|
+
values must be non-negative integers, where a higher number means the Aspect will be applied later, and a lower number means it will be applied sooner.
|
|
1783
|
+
|
|
1784
|
+
By default, newly created nodes always inherit aspects. Priorities are mainly for ordering between mutating aspects on the construct tree.
|
|
1785
|
+
|
|
1786
|
+
CDK provides standard priority values for mutating and readonly aspects to help ensure consistency across different construct libraries.
|
|
1787
|
+
Note that Aspects that have same priority value are not guaranteed to be executed
|
|
1788
|
+
in a consistent order.
|
|
1789
|
+
|
|
1790
|
+
```python
|
|
1791
|
+
#
|
|
1792
|
+
# Default Priority values for Aspects.
|
|
1793
|
+
#
|
|
1794
|
+
class AspectPriority:
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
If no priority is provided, the default value will be 500. This ensures that aspects without a specified priority run after mutating aspects but before
|
|
1798
|
+
any readonly aspects.
|
|
1799
|
+
|
|
1800
|
+
Correctly applying Aspects with priority values ensures that mutating aspects (such as adding tags or resources) run before validation aspects. This allows users to avoid misconfigurations and ensure that the final
|
|
1801
|
+
construct tree is fully validated before being synthesized.
|
|
1802
|
+
|
|
1803
|
+
### Applying Aspects with Priority
|
|
1804
|
+
|
|
1805
|
+
```python
|
|
1806
|
+
@jsii.implements(IAspect)
|
|
1807
|
+
class MutatingAspect:
|
|
1808
|
+
def visit(self, node):
|
|
1809
|
+
pass
|
|
1810
|
+
|
|
1811
|
+
@jsii.implements(IAspect)
|
|
1812
|
+
class ValidationAspect:
|
|
1813
|
+
def visit(self, node):
|
|
1814
|
+
pass
|
|
1815
|
+
|
|
1816
|
+
stack = Stack()
|
|
1817
|
+
|
|
1818
|
+
Aspects.of(stack).add(MutatingAspect(), priority=AspectPriority.MUTATING) # Run first (mutating aspects)
|
|
1819
|
+
Aspects.of(stack).add(ValidationAspect(), priority=AspectPriority.READONLY)
|
|
1820
|
+
```
|
|
1821
|
+
|
|
1822
|
+
### Inspecting applied aspects and changing priorities
|
|
1823
|
+
|
|
1824
|
+
We also give customers the ability to view all of their applied aspects and override the priority on these aspects.
|
|
1825
|
+
The `AspectApplication` class represents an Aspect that is applied to a node of the construct tree with a priority.
|
|
1826
|
+
|
|
1827
|
+
Users can access AspectApplications on a node by calling `applied` from the Aspects class as follows:
|
|
1828
|
+
|
|
1829
|
+
```python
|
|
1830
|
+
# root: Construct
|
|
1831
|
+
|
|
1832
|
+
app = App()
|
|
1833
|
+
stack = MyStack(app, "MyStack")
|
|
1834
|
+
|
|
1835
|
+
Aspects.of(stack).add(MyAspect())
|
|
1836
|
+
|
|
1837
|
+
aspect_applications = Aspects.of(root).applied
|
|
1838
|
+
|
|
1839
|
+
for aspect_application in aspect_applications:
|
|
1840
|
+
# The aspect we are applying
|
|
1841
|
+
print(aspect_application.aspect)
|
|
1842
|
+
# The construct we are applying the aspect to
|
|
1843
|
+
print(aspect_application.construct)
|
|
1844
|
+
# The priority it was applied with
|
|
1845
|
+
print(aspect_application.priority)
|
|
1846
|
+
|
|
1847
|
+
# Change the priority
|
|
1848
|
+
aspect_application.priority = 700
|
|
1849
|
+
```
|
|
1850
|
+
|
|
1531
1851
|
## Blueprint Property Injection
|
|
1532
1852
|
|
|
1533
1853
|
The goal of Blueprint Property Injection is to provide builders an automatic way to set default property values.
|