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

@@ -940,6 +940,132 @@ sfn.StateMachine(self, "MyStateMachine",
940
940
  )
941
941
  ```
942
942
 
943
+ ## Encryption
944
+
945
+ You can encrypt your data using a customer managed key for AWS Step Functions state machines and activities. You can configure a symmetric AWS KMS key and data key reuse period when creating or updating a State Machine or when creating an Activity. The execution history and state machine definition will be encrypted with the key applied to the State Machine. Activity inputs will be encrypted with the key applied to the Activity.
946
+
947
+ ### Encrypting state machines
948
+
949
+ You can provide a symmetric KMS key to encrypt the state machine definition and execution history:
950
+
951
+ ```python
952
+ import aws_cdk.aws_kms as kms
953
+ import aws_cdk as cdk
954
+
955
+
956
+ kms_key = kms.Key(self, "Key")
957
+ state_machine = sfn.StateMachine(self, "StateMachineWithCMKEncryptionConfiguration",
958
+ state_machine_name="StateMachineWithCMKEncryptionConfiguration",
959
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
960
+ state_machine_type=sfn.StateMachineType.STANDARD,
961
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(60))
962
+ )
963
+ ```
964
+
965
+ ### Encrypting state machine logs in Cloud Watch Logs
966
+
967
+ If a state machine is encrypted with a customer managed key and has logging enabled, its decrypted execution history will be stored in CloudWatch Logs. If you want to encrypt the logs from the state machine using your own KMS key, you can do so by configuring the `LogGroup` associated with the state machine to use a KMS key.
968
+
969
+ ```python
970
+ import aws_cdk.aws_kms as kms
971
+ import aws_cdk as cdk
972
+ import aws_cdk.aws_logs as logs
973
+
974
+
975
+ state_machine_kms_key = kms.Key(self, "StateMachine Key")
976
+ log_group_key = kms.Key(self, "LogGroup Key")
977
+
978
+ #
979
+ # Required KMS key policy which allows the CloudWatchLogs service principal to encrypt the entire log group using the
980
+ # customer managed kms key. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html#cmk-permissions
981
+ #
982
+ log_group_key.add_to_resource_policy(cdk.aws_iam.PolicyStatement(
983
+ resources=["*"],
984
+ actions=["kms:Encrypt*", "kms:Decrypt*", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:Describe*"],
985
+ principals=[cdk.aws_iam.ServicePrincipal(f"logs.{cdk.Stack.of(this).region}.amazonaws.com")],
986
+ conditions={
987
+ "ArnEquals": {
988
+ "kms:EncryptionContext:aws:logs:arn": cdk.Stack.of(self).format_arn(
989
+ service="logs",
990
+ resource="log-group",
991
+ sep=":",
992
+ resource_name="/aws/vendedlogs/states/MyLogGroup"
993
+ )
994
+ }
995
+ }
996
+ ))
997
+
998
+ # Create logGroup and provding encryptionKey which will be used to encrypt the log group
999
+ log_group = logs.LogGroup(self, "MyLogGroup",
1000
+ log_group_name="/aws/vendedlogs/states/MyLogGroup",
1001
+ encryption_key=log_group_key
1002
+ )
1003
+
1004
+ # Create state machine with CustomerManagedEncryptionConfiguration
1005
+ state_machine = sfn.StateMachine(self, "StateMachineWithCMKWithCWLEncryption",
1006
+ state_machine_name="StateMachineWithCMKWithCWLEncryption",
1007
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "PassState",
1008
+ result=sfn.Result.from_string("Hello World")
1009
+ ))),
1010
+ state_machine_type=sfn.StateMachineType.STANDARD,
1011
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(state_machine_kms_key),
1012
+ logs=sfn.LogOptions(
1013
+ destination=log_group,
1014
+ level=sfn.LogLevel.ALL,
1015
+ include_execution_data=True
1016
+ )
1017
+ )
1018
+ ```
1019
+
1020
+ ### Encrypting activity inputs
1021
+
1022
+ When you provide a symmetric KMS key, all inputs from the Step Functions Activity will be encrypted using the provided KMS key:
1023
+
1024
+ ```python
1025
+ import aws_cdk.aws_kms as kms
1026
+ import aws_cdk as cdk
1027
+
1028
+
1029
+ kms_key = kms.Key(self, "Key")
1030
+ activity = sfn.Activity(self, "ActivityWithCMKEncryptionConfiguration",
1031
+ activity_name="ActivityWithCMKEncryptionConfiguration",
1032
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(75))
1033
+ )
1034
+ ```
1035
+
1036
+ ### Changing Encryption
1037
+
1038
+ If you want to switch encryption from a customer provided key to a Step Functions owned key or vice-versa you must explicitly provide `encryptionConfiguration?`
1039
+
1040
+ #### Example: Switching from a customer managed key to a Step Functions owned key for StateMachine
1041
+
1042
+ #### Before
1043
+
1044
+ ```python
1045
+ import aws_cdk.aws_kms as kms
1046
+ import aws_cdk as cdk
1047
+
1048
+
1049
+ kms_key = kms.Key(self, "Key")
1050
+ state_machine = sfn.StateMachine(self, "StateMachine",
1051
+ state_machine_name="StateMachine",
1052
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
1053
+ state_machine_type=sfn.StateMachineType.STANDARD,
1054
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(60))
1055
+ )
1056
+ ```
1057
+
1058
+ #### After
1059
+
1060
+ ```python
1061
+ state_machine = sfn.StateMachine(self, "StateMachine",
1062
+ state_machine_name="StateMachine",
1063
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
1064
+ state_machine_type=sfn.StateMachineType.STANDARD,
1065
+ encryption_configuration=sfn.AwsOwnedEncryptionConfiguration()
1066
+ )
1067
+ ```
1068
+
943
1069
  ## X-Ray tracing
944
1070
 
945
1071
  Enable X-Ray tracing for StateMachine:
@@ -1149,6 +1275,7 @@ from ..aws_iam import (
1149
1275
  IRole as _IRole_235f5d8e,
1150
1276
  PolicyStatement as _PolicyStatement_0fe33853,
1151
1277
  )
1278
+ from ..aws_kms import IKey as _IKey_5f11635f
1152
1279
  from ..aws_logs import ILogGroup as _ILogGroup_3c4fa718
1153
1280
  from ..aws_s3 import IBucket as _IBucket_42e086fd
1154
1281
  from ..aws_s3_assets import AssetOptions as _AssetOptions_2aa69621
@@ -1157,32 +1284,46 @@ from ..aws_s3_assets import AssetOptions as _AssetOptions_2aa69621
1157
1284
  @jsii.data_type(
1158
1285
  jsii_type="aws-cdk-lib.aws_stepfunctions.ActivityProps",
1159
1286
  jsii_struct_bases=[],
1160
- name_mapping={"activity_name": "activityName"},
1287
+ name_mapping={
1288
+ "activity_name": "activityName",
1289
+ "encryption_configuration": "encryptionConfiguration",
1290
+ },
1161
1291
  )
1162
1292
  class ActivityProps:
1163
- def __init__(self, *, activity_name: typing.Optional[builtins.str] = None) -> None:
1293
+ def __init__(
1294
+ self,
1295
+ *,
1296
+ activity_name: typing.Optional[builtins.str] = None,
1297
+ encryption_configuration: typing.Optional["EncryptionConfiguration"] = None,
1298
+ ) -> None:
1164
1299
  '''Properties for defining a new Step Functions Activity.
1165
1300
 
1166
1301
  :param activity_name: The name for this activity. Default: - If not supplied, a name is generated
1302
+ :param encryption_configuration: The encryptionConfiguration object used for server-side encryption of the activity inputs. Default: - data is transparently encrypted using an AWS owned key
1167
1303
 
1168
- :exampleMetadata: fixture=_generated
1304
+ :exampleMetadata: infused
1169
1305
 
1170
1306
  Example::
1171
1307
 
1172
- # The code below shows an example of how to instantiate this type.
1173
- # The values are placeholders you should change.
1174
- from aws_cdk import aws_stepfunctions as stepfunctions
1308
+ import aws_cdk.aws_kms as kms
1309
+ import aws_cdk as cdk
1310
+
1175
1311
 
1176
- activity_props = stepfunctions.ActivityProps(
1177
- activity_name="activityName"
1312
+ kms_key = kms.Key(self, "Key")
1313
+ activity = sfn.Activity(self, "ActivityWithCMKEncryptionConfiguration",
1314
+ activity_name="ActivityWithCMKEncryptionConfiguration",
1315
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(75))
1178
1316
  )
1179
1317
  '''
1180
1318
  if __debug__:
1181
1319
  type_hints = typing.get_type_hints(_typecheckingstub__b22b644ed0224ed8911beae00f4c015272b0b6846f925702d315e05b17bfc26e)
1182
1320
  check_type(argname="argument activity_name", value=activity_name, expected_type=type_hints["activity_name"])
1321
+ check_type(argname="argument encryption_configuration", value=encryption_configuration, expected_type=type_hints["encryption_configuration"])
1183
1322
  self._values: typing.Dict[builtins.str, typing.Any] = {}
1184
1323
  if activity_name is not None:
1185
1324
  self._values["activity_name"] = activity_name
1325
+ if encryption_configuration is not None:
1326
+ self._values["encryption_configuration"] = encryption_configuration
1186
1327
 
1187
1328
  @builtins.property
1188
1329
  def activity_name(self) -> typing.Optional[builtins.str]:
@@ -1193,6 +1334,15 @@ class ActivityProps:
1193
1334
  result = self._values.get("activity_name")
1194
1335
  return typing.cast(typing.Optional[builtins.str], result)
1195
1336
 
1337
+ @builtins.property
1338
+ def encryption_configuration(self) -> typing.Optional["EncryptionConfiguration"]:
1339
+ '''The encryptionConfiguration object used for server-side encryption of the activity inputs.
1340
+
1341
+ :default: - data is transparently encrypted using an AWS owned key
1342
+ '''
1343
+ result = self._values.get("encryption_configuration")
1344
+ return typing.cast(typing.Optional["EncryptionConfiguration"], result)
1345
+
1196
1346
  def __eq__(self, rhs: typing.Any) -> builtins.bool:
1197
1347
  return isinstance(rhs, self.__class__) and rhs._values == self._values
1198
1348
 
@@ -5033,15 +5183,16 @@ class DefinitionBody(
5033
5183
 
5034
5184
  Example::
5035
5185
 
5036
- state_machine = stepfunctions.StateMachine(self, "SM",
5037
- definition_body=stepfunctions.DefinitionBody.from_chainable(stepfunctions.Wait(self, "Hello", time=stepfunctions.WaitTime.duration(Duration.seconds(10))))
5038
- )
5186
+ import aws_cdk.aws_kms as kms
5187
+ import aws_cdk as cdk
5188
+
5039
5189
 
5040
- iot.TopicRule(self, "TopicRule",
5041
- sql=iot.IotSql.from_string_as_ver20160323("SELECT * FROM 'device/+/data'"),
5042
- actions=[
5043
- actions.StepFunctionsStateMachineAction(state_machine)
5044
- ]
5190
+ kms_key = kms.Key(self, "Key")
5191
+ state_machine = sfn.StateMachine(self, "StateMachineWithCMKEncryptionConfiguration",
5192
+ state_machine_name="StateMachineWithCMKEncryptionConfiguration",
5193
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
5194
+ state_machine_type=sfn.StateMachineType.STANDARD,
5195
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(60))
5045
5196
  )
5046
5197
  '''
5047
5198
 
@@ -5246,6 +5397,62 @@ class DefinitionConfig:
5246
5397
  )
5247
5398
 
5248
5399
 
5400
+ class EncryptionConfiguration(
5401
+ metaclass=jsii.JSIIAbstractClass,
5402
+ jsii_type="aws-cdk-lib.aws_stepfunctions.EncryptionConfiguration",
5403
+ ):
5404
+ '''Base class for creating an EncryptionConfiguration for either state machines or activities.
5405
+
5406
+ :exampleMetadata: infused
5407
+
5408
+ Example::
5409
+
5410
+ import aws_cdk.aws_kms as kms
5411
+ import aws_cdk as cdk
5412
+
5413
+
5414
+ kms_key = kms.Key(self, "Key")
5415
+ state_machine = sfn.StateMachine(self, "StateMachineWithCMKEncryptionConfiguration",
5416
+ state_machine_name="StateMachineWithCMKEncryptionConfiguration",
5417
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
5418
+ state_machine_type=sfn.StateMachineType.STANDARD,
5419
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(60))
5420
+ )
5421
+ '''
5422
+
5423
+ def __init__(self, type: builtins.str) -> None:
5424
+ '''
5425
+ :param type: -
5426
+ '''
5427
+ if __debug__:
5428
+ type_hints = typing.get_type_hints(_typecheckingstub__c113cc29a83ef32340618ec6ac8314a8dcfa2f673103f63dd377e6550c5fa288)
5429
+ check_type(argname="argument type", value=type, expected_type=type_hints["type"])
5430
+ jsii.create(self.__class__, self, [type])
5431
+
5432
+ @builtins.property
5433
+ @jsii.member(jsii_name="type")
5434
+ def type(self) -> builtins.str:
5435
+ '''Encryption option for the state machine or activity.
5436
+
5437
+ Can be either CUSTOMER_MANAGED_KMS_KEY or AWS_OWNED_KEY.
5438
+ '''
5439
+ return typing.cast(builtins.str, jsii.get(self, "type"))
5440
+
5441
+ @type.setter
5442
+ def type(self, value: builtins.str) -> None:
5443
+ if __debug__:
5444
+ type_hints = typing.get_type_hints(_typecheckingstub__8a2804b763864fbee1b32e3adb87dca68d59b11748f0449749b31ff8c5f91264)
5445
+ check_type(argname="argument value", value=value, expected_type=type_hints["value"])
5446
+ jsii.set(self, "type", value) # pyright: ignore[reportArgumentType]
5447
+
5448
+
5449
+ class _EncryptionConfigurationProxy(EncryptionConfiguration):
5450
+ pass
5451
+
5452
+ # Adding a "__jsii_proxy_class__(): typing.Type" function to the abstract class
5453
+ typing.cast(typing.Any, EncryptionConfiguration).__jsii_proxy_class__ = lambda : _EncryptionConfigurationProxy
5454
+
5455
+
5249
5456
  class Errors(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_stepfunctions.Errors"):
5250
5457
  '''Predefined error strings Error names in Amazon States Language - https://states-language.net/spec.html#appendix-a Error handling in Step Functions - https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html.
5251
5458
 
@@ -5722,6 +5929,15 @@ class IActivity(_IResource_c80c4260, typing_extensions.Protocol):
5722
5929
  '''
5723
5930
  ...
5724
5931
 
5932
+ @builtins.property
5933
+ @jsii.member(jsii_name="encryptionConfiguration")
5934
+ def encryption_configuration(self) -> typing.Optional[EncryptionConfiguration]:
5935
+ '''The encryptionConfiguration object used for server-side encryption of the activity inputs.
5936
+
5937
+ :attribute: true
5938
+ '''
5939
+ ...
5940
+
5725
5941
 
5726
5942
  class _IActivityProxy(
5727
5943
  jsii.proxy_for(_IResource_c80c4260), # type: ignore[misc]
@@ -5748,6 +5964,15 @@ class _IActivityProxy(
5748
5964
  '''
5749
5965
  return typing.cast(builtins.str, jsii.get(self, "activityName"))
5750
5966
 
5967
+ @builtins.property
5968
+ @jsii.member(jsii_name="encryptionConfiguration")
5969
+ def encryption_configuration(self) -> typing.Optional[EncryptionConfiguration]:
5970
+ '''The encryptionConfiguration object used for server-side encryption of the activity inputs.
5971
+
5972
+ :attribute: true
5973
+ '''
5974
+ return typing.cast(typing.Optional[EncryptionConfiguration], jsii.get(self, "encryptionConfiguration"))
5975
+
5751
5976
  # Adding a "__jsii_proxy_class__(): typing.Type" function to the interface
5752
5977
  typing.cast(typing.Any, IActivity).__jsii_proxy_class__ = lambda : _IActivityProxy
5753
5978
 
@@ -10419,6 +10644,7 @@ class StateMachine(
10419
10644
  definition: typing.Optional[IChainable] = None,
10420
10645
  definition_body: typing.Optional[DefinitionBody] = None,
10421
10646
  definition_substitutions: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
10647
+ encryption_configuration: typing.Optional[EncryptionConfiguration] = None,
10422
10648
  logs: typing.Optional[typing.Union[LogOptions, typing.Dict[builtins.str, typing.Any]]] = None,
10423
10649
  removal_policy: typing.Optional[_RemovalPolicy_9f93c814] = None,
10424
10650
  role: typing.Optional[_IRole_235f5d8e] = None,
@@ -10434,6 +10660,7 @@ class StateMachine(
10434
10660
  :param definition: (deprecated) Definition for this state machine.
10435
10661
  :param definition_body: Definition for this state machine.
10436
10662
  :param definition_substitutions: substitutions for the definition body as a key-value map.
10663
+ :param encryption_configuration: Configures server-side encryption of the state machine definition and execution history. Default: - data is transparently encrypted using an AWS owned key
10437
10664
  :param logs: Defines what execution history events are logged and where they are logged. Default: No logging
10438
10665
  :param removal_policy: The removal policy to apply to state machine. Default: RemovalPolicy.DESTROY
10439
10666
  :param role: The execution role for the state machine service. Default: A role is automatically created
@@ -10451,6 +10678,7 @@ class StateMachine(
10451
10678
  definition=definition,
10452
10679
  definition_body=definition_body,
10453
10680
  definition_substitutions=definition_substitutions,
10681
+ encryption_configuration=encryption_configuration,
10454
10682
  logs=logs,
10455
10683
  removal_policy=removal_policy,
10456
10684
  role=role,
@@ -11129,6 +11357,7 @@ typing.cast(typing.Any, StateMachineFragment).__jsii_proxy_class__ = lambda : _S
11129
11357
  "definition": "definition",
11130
11358
  "definition_body": "definitionBody",
11131
11359
  "definition_substitutions": "definitionSubstitutions",
11360
+ "encryption_configuration": "encryptionConfiguration",
11132
11361
  "logs": "logs",
11133
11362
  "removal_policy": "removalPolicy",
11134
11363
  "role": "role",
@@ -11146,6 +11375,7 @@ class StateMachineProps:
11146
11375
  definition: typing.Optional[IChainable] = None,
11147
11376
  definition_body: typing.Optional[DefinitionBody] = None,
11148
11377
  definition_substitutions: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
11378
+ encryption_configuration: typing.Optional[EncryptionConfiguration] = None,
11149
11379
  logs: typing.Optional[typing.Union[LogOptions, typing.Dict[builtins.str, typing.Any]]] = None,
11150
11380
  removal_policy: typing.Optional[_RemovalPolicy_9f93c814] = None,
11151
11381
  role: typing.Optional[_IRole_235f5d8e] = None,
@@ -11160,6 +11390,7 @@ class StateMachineProps:
11160
11390
  :param definition: (deprecated) Definition for this state machine.
11161
11391
  :param definition_body: Definition for this state machine.
11162
11392
  :param definition_substitutions: substitutions for the definition body as a key-value map.
11393
+ :param encryption_configuration: Configures server-side encryption of the state machine definition and execution history. Default: - data is transparently encrypted using an AWS owned key
11163
11394
  :param logs: Defines what execution history events are logged and where they are logged. Default: No logging
11164
11395
  :param removal_policy: The removal policy to apply to state machine. Default: RemovalPolicy.DESTROY
11165
11396
  :param role: The execution role for the state machine service. Default: A role is automatically created
@@ -11199,6 +11430,7 @@ class StateMachineProps:
11199
11430
  check_type(argname="argument definition", value=definition, expected_type=type_hints["definition"])
11200
11431
  check_type(argname="argument definition_body", value=definition_body, expected_type=type_hints["definition_body"])
11201
11432
  check_type(argname="argument definition_substitutions", value=definition_substitutions, expected_type=type_hints["definition_substitutions"])
11433
+ check_type(argname="argument encryption_configuration", value=encryption_configuration, expected_type=type_hints["encryption_configuration"])
11202
11434
  check_type(argname="argument logs", value=logs, expected_type=type_hints["logs"])
11203
11435
  check_type(argname="argument removal_policy", value=removal_policy, expected_type=type_hints["removal_policy"])
11204
11436
  check_type(argname="argument role", value=role, expected_type=type_hints["role"])
@@ -11215,6 +11447,8 @@ class StateMachineProps:
11215
11447
  self._values["definition_body"] = definition_body
11216
11448
  if definition_substitutions is not None:
11217
11449
  self._values["definition_substitutions"] = definition_substitutions
11450
+ if encryption_configuration is not None:
11451
+ self._values["encryption_configuration"] = encryption_configuration
11218
11452
  if logs is not None:
11219
11453
  self._values["logs"] = logs
11220
11454
  if removal_policy is not None:
@@ -11264,6 +11498,15 @@ class StateMachineProps:
11264
11498
  result = self._values.get("definition_substitutions")
11265
11499
  return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
11266
11500
 
11501
+ @builtins.property
11502
+ def encryption_configuration(self) -> typing.Optional[EncryptionConfiguration]:
11503
+ '''Configures server-side encryption of the state machine definition and execution history.
11504
+
11505
+ :default: - data is transparently encrypted using an AWS owned key
11506
+ '''
11507
+ result = self._values.get("encryption_configuration")
11508
+ return typing.cast(typing.Optional[EncryptionConfiguration], result)
11509
+
11267
11510
  @builtins.property
11268
11511
  def logs(self) -> typing.Optional[LogOptions]:
11269
11512
  '''Defines what execution history events are logged and where they are logged.
@@ -11350,13 +11593,16 @@ class StateMachineType(enum.Enum):
11350
11593
 
11351
11594
  Example::
11352
11595
 
11353
- distributed_map = sfn.DistributedMap(self, "DistributedMap",
11354
- map_execution_type=sfn.StateMachineType.EXPRESS
11355
- )
11596
+ import aws_cdk.aws_kms as kms
11597
+ import aws_cdk as cdk
11356
11598
 
11357
- distributed_map.item_processor(sfn.Pass(self, "Pass"),
11358
- mode=sfn.ProcessorMode.DISTRIBUTED,
11359
- execution_type=sfn.ProcessorType.STANDARD
11599
+
11600
+ kms_key = kms.Key(self, "Key")
11601
+ state_machine = sfn.StateMachine(self, "StateMachineWithCMKEncryptionConfiguration",
11602
+ state_machine_name="StateMachineWithCMKEncryptionConfiguration",
11603
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
11604
+ state_machine_type=sfn.StateMachineType.STANDARD,
11605
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(60))
11360
11606
  )
11361
11607
  '''
11362
11608
 
@@ -13539,17 +13785,22 @@ class Activity(
13539
13785
  id: builtins.str,
13540
13786
  *,
13541
13787
  activity_name: typing.Optional[builtins.str] = None,
13788
+ encryption_configuration: typing.Optional[EncryptionConfiguration] = None,
13542
13789
  ) -> None:
13543
13790
  '''
13544
13791
  :param scope: -
13545
13792
  :param id: -
13546
13793
  :param activity_name: The name for this activity. Default: - If not supplied, a name is generated
13794
+ :param encryption_configuration: The encryptionConfiguration object used for server-side encryption of the activity inputs. Default: - data is transparently encrypted using an AWS owned key
13547
13795
  '''
13548
13796
  if __debug__:
13549
13797
  type_hints = typing.get_type_hints(_typecheckingstub__a9e3c9e855deb3c2b532345b0d2587dc14ad685d296794311bbf280ab9f6b10d)
13550
13798
  check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
13551
13799
  check_type(argname="argument id", value=id, expected_type=type_hints["id"])
13552
- props = ActivityProps(activity_name=activity_name)
13800
+ props = ActivityProps(
13801
+ activity_name=activity_name,
13802
+ encryption_configuration=encryption_configuration,
13803
+ )
13553
13804
 
13554
13805
  jsii.create(self.__class__, self, [scope, id, props])
13555
13806
 
@@ -14025,6 +14276,38 @@ class Activity(
14025
14276
  '''
14026
14277
  return typing.cast(builtins.str, jsii.get(self, "activityName"))
14027
14278
 
14279
+ @builtins.property
14280
+ @jsii.member(jsii_name="encryptionConfiguration")
14281
+ def encryption_configuration(self) -> typing.Optional[EncryptionConfiguration]:
14282
+ '''The encryptionConfiguration object used for server-side encryption of the activity inputs.
14283
+
14284
+ :attribute: true
14285
+ '''
14286
+ return typing.cast(typing.Optional[EncryptionConfiguration], jsii.get(self, "encryptionConfiguration"))
14287
+
14288
+
14289
+ class AwsOwnedEncryptionConfiguration(
14290
+ EncryptionConfiguration,
14291
+ metaclass=jsii.JSIIMeta,
14292
+ jsii_type="aws-cdk-lib.aws_stepfunctions.AwsOwnedEncryptionConfiguration",
14293
+ ):
14294
+ '''Define a new AwsOwnedEncryptionConfiguration.
14295
+
14296
+ :exampleMetadata: infused
14297
+
14298
+ Example::
14299
+
14300
+ state_machine = sfn.StateMachine(self, "StateMachine",
14301
+ state_machine_name="StateMachine",
14302
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
14303
+ state_machine_type=sfn.StateMachineType.STANDARD,
14304
+ encryption_configuration=sfn.AwsOwnedEncryptionConfiguration()
14305
+ )
14306
+ '''
14307
+
14308
+ def __init__(self) -> None:
14309
+ jsii.create(self.__class__, self, [])
14310
+
14028
14311
 
14029
14312
  @jsii.implements(IChainable)
14030
14313
  class Chain(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_stepfunctions.Chain"):
@@ -14541,6 +14824,68 @@ class CustomState(
14541
14824
  return typing.cast(typing.List[INextable], jsii.get(self, "endStates"))
14542
14825
 
14543
14826
 
14827
+ class CustomerManagedEncryptionConfiguration(
14828
+ EncryptionConfiguration,
14829
+ metaclass=jsii.JSIIMeta,
14830
+ jsii_type="aws-cdk-lib.aws_stepfunctions.CustomerManagedEncryptionConfiguration",
14831
+ ):
14832
+ '''Define a new CustomerManagedEncryptionConfiguration.
14833
+
14834
+ :exampleMetadata: infused
14835
+
14836
+ Example::
14837
+
14838
+ import aws_cdk.aws_kms as kms
14839
+ import aws_cdk as cdk
14840
+
14841
+
14842
+ kms_key = kms.Key(self, "Key")
14843
+ state_machine = sfn.StateMachine(self, "StateMachineWithCMKEncryptionConfiguration",
14844
+ state_machine_name="StateMachineWithCMKEncryptionConfiguration",
14845
+ definition_body=sfn.DefinitionBody.from_chainable(sfn.Chain.start(sfn.Pass(self, "Pass"))),
14846
+ state_machine_type=sfn.StateMachineType.STANDARD,
14847
+ encryption_configuration=sfn.CustomerManagedEncryptionConfiguration(kms_key, cdk.Duration.seconds(60))
14848
+ )
14849
+ '''
14850
+
14851
+ def __init__(
14852
+ self,
14853
+ kms_key: _IKey_5f11635f,
14854
+ kms_data_key_reuse_period_seconds: typing.Optional[_Duration_4839e8c3] = None,
14855
+ ) -> None:
14856
+ '''
14857
+ :param kms_key: -
14858
+ :param kms_data_key_reuse_period_seconds: -
14859
+ '''
14860
+ if __debug__:
14861
+ type_hints = typing.get_type_hints(_typecheckingstub__49c419f1b0cde6ecd2360bc2aeba72512cfc8d5f6b3745284a5b2819a1fc37bf)
14862
+ check_type(argname="argument kms_key", value=kms_key, expected_type=type_hints["kms_key"])
14863
+ check_type(argname="argument kms_data_key_reuse_period_seconds", value=kms_data_key_reuse_period_seconds, expected_type=type_hints["kms_data_key_reuse_period_seconds"])
14864
+ jsii.create(self.__class__, self, [kms_key, kms_data_key_reuse_period_seconds])
14865
+
14866
+ @builtins.property
14867
+ @jsii.member(jsii_name="kmsKey")
14868
+ def kms_key(self) -> _IKey_5f11635f:
14869
+ '''The symmetric customer managed KMS key for server-side encryption of the state machine definition, and execution history or activity inputs.
14870
+
14871
+ Step Functions will reuse the key for a maximum of ``kmsDataKeyReusePeriodSeconds``.
14872
+
14873
+ :default: - data is transparently encrypted using an AWS owned key
14874
+ '''
14875
+ return typing.cast(_IKey_5f11635f, jsii.get(self, "kmsKey"))
14876
+
14877
+ @builtins.property
14878
+ @jsii.member(jsii_name="kmsDataKeyReusePeriodSeconds")
14879
+ def kms_data_key_reuse_period_seconds(self) -> typing.Optional[_Duration_4839e8c3]:
14880
+ '''Maximum duration that Step Functions will reuse customer managed data keys. When the period expires, Step Functions will call GenerateDataKey.
14881
+
14882
+ Must be between 60 and 900 seconds.
14883
+
14884
+ :default: Duration.seconds(300)
14885
+ '''
14886
+ return typing.cast(typing.Optional[_Duration_4839e8c3], jsii.get(self, "kmsDataKeyReusePeriodSeconds"))
14887
+
14888
+
14544
14889
  @jsii.data_type(
14545
14890
  jsii_type="aws-cdk-lib.aws_stepfunctions.DistributedMapProps",
14546
14891
  jsii_struct_bases=[MapBaseProps],
@@ -15305,17 +15650,26 @@ class Pass(
15305
15650
 
15306
15651
  Example::
15307
15652
 
15308
- choice = sfn.Choice(self, "Did it work?")
15653
+ # Define a state machine with one Pass state
15654
+ child = sfn.StateMachine(self, "ChildStateMachine",
15655
+ definition=sfn.Chain.start(sfn.Pass(self, "PassState"))
15656
+ )
15309
15657
 
15310
- # Add conditions with .when()
15311
- success_state = sfn.Pass(self, "SuccessState")
15312
- failure_state = sfn.Pass(self, "FailureState")
15313
- choice.when(sfn.Condition.string_equals("$.status", "SUCCESS"), success_state)
15314
- choice.when(sfn.Condition.number_greater_than("$.attempts", 5), failure_state)
15658
+ # Include the state machine in a Task state with callback pattern
15659
+ task = tasks.StepFunctionsStartExecution(self, "ChildTask",
15660
+ state_machine=child,
15661
+ integration_pattern=sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
15662
+ input=sfn.TaskInput.from_object({
15663
+ "token": sfn.JsonPath.task_token,
15664
+ "foo": "bar"
15665
+ }),
15666
+ name="MyExecutionName"
15667
+ )
15315
15668
 
15316
- # Use .otherwise() to indicate what should be done if none of the conditions match
15317
- try_again_state = sfn.Pass(self, "TryAgainState")
15318
- choice.otherwise(try_again_state)
15669
+ # Define a second state machine with the Task state above
15670
+ sfn.StateMachine(self, "ParentStateMachine",
15671
+ definition=task
15672
+ )
15319
15673
  '''
15320
15674
 
15321
15675
  def __init__(
@@ -15918,6 +16272,7 @@ __all__ = [
15918
16272
  "Activity",
15919
16273
  "ActivityProps",
15920
16274
  "AfterwardsOptions",
16275
+ "AwsOwnedEncryptionConfiguration",
15921
16276
  "CatchProps",
15922
16277
  "CfnActivity",
15923
16278
  "CfnActivityProps",
@@ -15938,10 +16293,12 @@ __all__ = [
15938
16293
  "CsvHeaders",
15939
16294
  "CustomState",
15940
16295
  "CustomStateProps",
16296
+ "CustomerManagedEncryptionConfiguration",
15941
16297
  "DefinitionBody",
15942
16298
  "DefinitionConfig",
15943
16299
  "DistributedMap",
15944
16300
  "DistributedMapProps",
16301
+ "EncryptionConfiguration",
15945
16302
  "Errors",
15946
16303
  "Fail",
15947
16304
  "FailProps",
@@ -16013,6 +16370,7 @@ publication.publish()
16013
16370
  def _typecheckingstub__b22b644ed0224ed8911beae00f4c015272b0b6846f925702d315e05b17bfc26e(
16014
16371
  *,
16015
16372
  activity_name: typing.Optional[builtins.str] = None,
16373
+ encryption_configuration: typing.Optional[EncryptionConfiguration] = None,
16016
16374
  ) -> None:
16017
16375
  """Type checking stubs"""
16018
16376
  pass
@@ -16800,6 +17158,18 @@ def _typecheckingstub__0110b36a0362589a48107daf28e3afe725be68dbbc869656e5a397d95
16800
17158
  """Type checking stubs"""
16801
17159
  pass
16802
17160
 
17161
+ def _typecheckingstub__c113cc29a83ef32340618ec6ac8314a8dcfa2f673103f63dd377e6550c5fa288(
17162
+ type: builtins.str,
17163
+ ) -> None:
17164
+ """Type checking stubs"""
17165
+ pass
17166
+
17167
+ def _typecheckingstub__8a2804b763864fbee1b32e3adb87dca68d59b11748f0449749b31ff8c5f91264(
17168
+ value: builtins.str,
17169
+ ) -> None:
17170
+ """Type checking stubs"""
17171
+ pass
17172
+
16803
17173
  def _typecheckingstub__e34991edae92aa24b2bb75c9df693e2185f13c40aaf16ee220fc07ef991eaa7c(
16804
17174
  *,
16805
17175
  cause: typing.Optional[builtins.str] = None,
@@ -17424,6 +17794,7 @@ def _typecheckingstub__efdfc02291401a50a1d945e5208e9becb9828352fec32bc109ccebafc
17424
17794
  definition: typing.Optional[IChainable] = None,
17425
17795
  definition_body: typing.Optional[DefinitionBody] = None,
17426
17796
  definition_substitutions: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
17797
+ encryption_configuration: typing.Optional[EncryptionConfiguration] = None,
17427
17798
  logs: typing.Optional[typing.Union[LogOptions, typing.Dict[builtins.str, typing.Any]]] = None,
17428
17799
  removal_policy: typing.Optional[_RemovalPolicy_9f93c814] = None,
17429
17800
  role: typing.Optional[_IRole_235f5d8e] = None,
@@ -17535,6 +17906,7 @@ def _typecheckingstub__24d23b501c893898901860f31ff1a0a0fa81eb89f06a7acf3eef4f15e
17535
17906
  definition: typing.Optional[IChainable] = None,
17536
17907
  definition_body: typing.Optional[DefinitionBody] = None,
17537
17908
  definition_substitutions: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
17909
+ encryption_configuration: typing.Optional[EncryptionConfiguration] = None,
17538
17910
  logs: typing.Optional[typing.Union[LogOptions, typing.Dict[builtins.str, typing.Any]]] = None,
17539
17911
  removal_policy: typing.Optional[_RemovalPolicy_9f93c814] = None,
17540
17912
  role: typing.Optional[_IRole_235f5d8e] = None,
@@ -17791,6 +18163,7 @@ def _typecheckingstub__a9e3c9e855deb3c2b532345b0d2587dc14ad685d296794311bbf280ab
17791
18163
  id: builtins.str,
17792
18164
  *,
17793
18165
  activity_name: typing.Optional[builtins.str] = None,
18166
+ encryption_configuration: typing.Optional[EncryptionConfiguration] = None,
17794
18167
  ) -> None:
17795
18168
  """Type checking stubs"""
17796
18169
  pass
@@ -17939,6 +18312,13 @@ def _typecheckingstub__c55cf19adb97a87b3d9f8561497d58ec4f0dc221883c0d757f4bec5f4
17939
18312
  """Type checking stubs"""
17940
18313
  pass
17941
18314
 
18315
+ def _typecheckingstub__49c419f1b0cde6ecd2360bc2aeba72512cfc8d5f6b3745284a5b2819a1fc37bf(
18316
+ kms_key: _IKey_5f11635f,
18317
+ kms_data_key_reuse_period_seconds: typing.Optional[_Duration_4839e8c3] = None,
18318
+ ) -> None:
18319
+ """Type checking stubs"""
18320
+ pass
18321
+
17942
18322
  def _typecheckingstub__e484af477b46c0e70f635ed9610c7183f70c2184fd7a48f091a5477df9ee3d5d(
17943
18323
  *,
17944
18324
  comment: typing.Optional[builtins.str] = None,