aws-cdk-lib 2.143.1__py3-none-any.whl → 2.145.0__py3-none-any.whl

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

Potentially problematic release.


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

Files changed (43) hide show
  1. aws_cdk/__init__.py +1 -1
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.143.1.jsii.tgz → aws-cdk-lib@2.145.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_apigatewayv2_authorizers/__init__.py +27 -0
  5. aws_cdk/aws_apigatewayv2_integrations/__init__.py +28 -0
  6. aws_cdk/aws_appconfig/__init__.py +132 -1
  7. aws_cdk/aws_autoscaling/__init__.py +4 -4
  8. aws_cdk/aws_bedrock/__init__.py +48 -0
  9. aws_cdk/aws_chatbot/__init__.py +149 -2
  10. aws_cdk/aws_cloudfront/experimental/__init__.py +65 -9
  11. aws_cdk/aws_codebuild/__init__.py +801 -16
  12. aws_cdk/aws_config/__init__.py +1305 -45
  13. aws_cdk/aws_dynamodb/__init__.py +309 -3
  14. aws_cdk/aws_ec2/__init__.py +112 -31
  15. aws_cdk/aws_ecs_patterns/__init__.py +89 -7
  16. aws_cdk/aws_eks/__init__.py +185 -41
  17. aws_cdk/aws_fsx/__init__.py +4 -4
  18. aws_cdk/aws_glue/__init__.py +39 -0
  19. aws_cdk/aws_iam/__init__.py +3 -3
  20. aws_cdk/aws_lambda/__init__.py +605 -42
  21. aws_cdk/aws_lambda_nodejs/__init__.py +160 -13
  22. aws_cdk/aws_logs/__init__.py +114 -8
  23. aws_cdk/aws_logs_destinations/__init__.py +11 -9
  24. aws_cdk/aws_mediaconnect/__init__.py +2 -6
  25. aws_cdk/aws_medialive/__init__.py +20 -2
  26. aws_cdk/aws_mediapackagev2/__init__.py +476 -0
  27. aws_cdk/aws_rds/__init__.py +27 -19
  28. aws_cdk/aws_route53/__init__.py +3 -3
  29. aws_cdk/aws_s3/__init__.py +21 -0
  30. aws_cdk/aws_s3_deployment/__init__.py +3 -2
  31. aws_cdk/aws_securityhub/__init__.py +2415 -374
  32. aws_cdk/aws_securitylake/__init__.py +179 -314
  33. aws_cdk/aws_sqs/__init__.py +2 -2
  34. aws_cdk/aws_stepfunctions/__init__.py +53 -24
  35. aws_cdk/aws_stepfunctions_tasks/__init__.py +763 -16
  36. aws_cdk/pipelines/__init__.py +2 -0
  37. aws_cdk/triggers/__init__.py +65 -9
  38. {aws_cdk_lib-2.143.1.dist-info → aws_cdk_lib-2.145.0.dist-info}/METADATA +1 -1
  39. {aws_cdk_lib-2.143.1.dist-info → aws_cdk_lib-2.145.0.dist-info}/RECORD +43 -43
  40. {aws_cdk_lib-2.143.1.dist-info → aws_cdk_lib-2.145.0.dist-info}/WHEEL +1 -1
  41. {aws_cdk_lib-2.143.1.dist-info → aws_cdk_lib-2.145.0.dist-info}/LICENSE +0 -0
  42. {aws_cdk_lib-2.143.1.dist-info → aws_cdk_lib-2.145.0.dist-info}/NOTICE +0 -0
  43. {aws_cdk_lib-2.143.1.dist-info → aws_cdk_lib-2.145.0.dist-info}/top_level.txt +0 -0
@@ -387,6 +387,68 @@ nodejs.NodejsFunction(self, "my-handler",
387
387
  )
388
388
  )
389
389
  ```
390
+
391
+ ## Running a custom build script as part of cdk synthesis
392
+
393
+ If you need more control over bundling -- or the build process in general -- then we include the ability to invoke your own build script. For example, if you have the following `build.mjs` file:
394
+
395
+ ```
396
+ import * as path from 'path';
397
+ import { fileURLToPath } from 'url';
398
+ import esbuild from "esbuild";
399
+ import { cache } from "esbuild-plugin-cache";
400
+ import time from "esbuild-plugin-time";
401
+
402
+ const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
403
+ const __dirname = path.dirname(__filename); // get the name of the directory
404
+
405
+ await esbuild
406
+ .build({
407
+ entryPoints: [path.join(__dirname, 'handler', 'index.ts')],
408
+ outfile: path.join(__dirname, 'build-output', 'index.js'),
409
+ external: ['@aws-sdk/*', 'aws-sdk'],
410
+ format: 'cjs',
411
+ platform: 'node',
412
+ target: 'node18',
413
+ bundle: true,
414
+ minify: true,
415
+ plugins: [time(), cache({ directory: ".cache" })],
416
+ })
417
+ .catch((error) => {
418
+ console.log(error);
419
+ process.exit(1)
420
+ });
421
+ ```
422
+
423
+ then you could use `build.mjs` in a cdk construct as follows:
424
+
425
+ ```
426
+ export class ExampleStack extends Stack {
427
+ public constructor(scope: Construct, id: string, props?: StackProps) {
428
+ super(scope, id, props);
429
+
430
+ const pathToBuildFile = path.join(__dirname, 'build.mjs');
431
+
432
+ // assuming the `handler` property is specified as 'index.handler' (as in this example), then
433
+ // this 'build-output' directory must contain an index.js file with an exported `handler` function.
434
+ const pathToOutputFile = path.join(__dirname, 'build-output');
435
+ const handler = 'index.handler';
436
+
437
+ const commandThatIsRanDuringCdkSynth = ['node', pathToBuildFile];
438
+ const code = lambda.Code.fromCustomCommand(
439
+ pathToOutputFile,
440
+ commandThatIsRanDuringCdkSynth,
441
+ );
442
+
443
+ new nodejs.NodejsFunction(this, 'NodejsFunctionBuild', {
444
+ code,
445
+ handler,
446
+ });
447
+ }
448
+ }
449
+ ```
450
+
451
+ where the `build-output` would be a directory that contains an `index.js` file with an exported `handler` function.
390
452
  '''
391
453
  from pkgutil import extend_path
392
454
  __path__ = extend_path(__path__, __name__)
@@ -426,7 +488,9 @@ from ..aws_iam import (
426
488
  from ..aws_kms import IKey as _IKey_5f11635f
427
489
  from ..aws_lambda import (
428
490
  AdotInstrumentationConfig as _AdotInstrumentationConfig_7c38d65d,
491
+ ApplicationLogLevel as _ApplicationLogLevel_cd92660a,
429
492
  Architecture as _Architecture_12d5a53f,
493
+ Code as _Code_7848f942,
430
494
  FileSystem as _FileSystem_a5fa005d,
431
495
  Function as _Function_244f85d8,
432
496
  FunctionOptions as _FunctionOptions_328f4d39,
@@ -441,6 +505,7 @@ from ..aws_lambda import (
441
505
  Runtime as _Runtime_b4eaa844,
442
506
  RuntimeManagementMode as _RuntimeManagementMode_688c173b,
443
507
  SnapStartConf as _SnapStartConf_2ffaa769,
508
+ SystemLogLevel as _SystemLogLevel_aea49dc2,
444
509
  Tracing as _Tracing_9fe8e2bb,
445
510
  VersionOptions as _VersionOptions_981bb3c0,
446
511
  )
@@ -1483,6 +1548,7 @@ class NodejsFunction(
1483
1548
  *,
1484
1549
  aws_sdk_connection_reuse: typing.Optional[builtins.bool] = None,
1485
1550
  bundling: typing.Optional[typing.Union[BundlingOptions, typing.Dict[builtins.str, typing.Any]]] = None,
1551
+ code: typing.Optional[_Code_7848f942] = None,
1486
1552
  deps_lock_file_path: typing.Optional[builtins.str] = None,
1487
1553
  entry: typing.Optional[builtins.str] = None,
1488
1554
  handler: typing.Optional[builtins.str] = None,
@@ -1492,6 +1558,7 @@ class NodejsFunction(
1492
1558
  allow_all_outbound: typing.Optional[builtins.bool] = None,
1493
1559
  allow_public_subnet: typing.Optional[builtins.bool] = None,
1494
1560
  application_log_level: typing.Optional[builtins.str] = None,
1561
+ application_log_level_v2: typing.Optional[_ApplicationLogLevel_cd92660a] = None,
1495
1562
  architecture: typing.Optional[_Architecture_12d5a53f] = None,
1496
1563
  code_signing_config: typing.Optional[_ICodeSigningConfig_edb41d1f] = None,
1497
1564
  current_version_options: typing.Optional[typing.Union[_VersionOptions_981bb3c0, typing.Dict[builtins.str, typing.Any]]] = None,
@@ -1525,6 +1592,7 @@ class NodejsFunction(
1525
1592
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
1526
1593
  snap_start: typing.Optional[_SnapStartConf_2ffaa769] = None,
1527
1594
  system_log_level: typing.Optional[builtins.str] = None,
1595
+ system_log_level_v2: typing.Optional[_SystemLogLevel_aea49dc2] = None,
1528
1596
  timeout: typing.Optional[_Duration_4839e8c3] = None,
1529
1597
  tracing: typing.Optional[_Tracing_9fe8e2bb] = None,
1530
1598
  vpc: typing.Optional[_IVpc_f30d5663] = None,
@@ -1539,15 +1607,17 @@ class NodejsFunction(
1539
1607
  :param id: -
1540
1608
  :param aws_sdk_connection_reuse: The ``AWS_NODEJS_CONNECTION_REUSE_ENABLED`` environment variable does not exist in the AWS SDK for JavaScript v3. This prop will be deprecated when the Lambda Node16 runtime is deprecated on June 12, 2024. See https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-support-policy Info for Node 16 runtimes / SDK v2 users: Whether to automatically reuse TCP connections when working with the AWS SDK for JavaScript v2. This sets the ``AWS_NODEJS_CONNECTION_REUSE_ENABLED`` environment variable to ``1``. Default: - false (obsolete) for runtimes >= Node 18, true for runtimes <= Node 16.
1541
1609
  :param bundling: Bundling options. Default: - use default bundling options: no minify, no sourcemap, all modules are bundled.
1610
+ :param code: The code that will be deployed to the Lambda Handler. If included, then properties related to bundling of the code are ignored. - If the ``code`` field is specified, then you must include the ``handler`` property. Default: - the code is bundled by esbuild
1542
1611
  :param deps_lock_file_path: The path to the dependencies lock file (``yarn.lock``, ``pnpm-lock.yaml`` or ``package-lock.json``). This will be used as the source for the volume mounted in the Docker container. Modules specified in ``nodeModules`` will be installed using the right installer (``yarn``, ``pnpm`` or ``npm``) along with this lock file. Default: - the path is found by walking up parent directories searching for a ``yarn.lock``, ``pnpm-lock.yaml`` or ``package-lock.json`` file
1543
1612
  :param entry: Path to the entry file (JavaScript or TypeScript). Default: - Derived from the name of the defining file and the construct's id. If the ``NodejsFunction`` is defined in ``stack.ts`` with ``my-handler`` as id (``new NodejsFunction(this, 'my-handler')``), the construct will look at ``stack.my-handler.ts`` and ``stack.my-handler.js``.
1544
- :param handler: The name of the exported handler in the entry file. The handler is prefixed with ``index.`` unless the specified handler value contains a ``.``, in which case it is used as-is. Default: handler
1613
+ :param handler: The name of the exported handler in the entry file. - If the ``code`` property is supplied, then you must include the ``handler`` property. The handler should be the name of the file that contains the exported handler and the function that should be called when the AWS Lambda is invoked. For example, if you had a file called ``myLambda.js`` and the function to be invoked was ``myHandler``, then you should input ``handler`` property as ``myLambda.myHandler``. - If the ``code`` property is not supplied and the handler input does not contain a ``.``, then the handler is prefixed with ``index.`` (index period). Otherwise, the handler property is not modified. Default: handler
1545
1614
  :param project_root: The path to the directory containing project config files (``package.json`` or ``tsconfig.json``). Default: - the directory containing the ``depsLockFilePath``
1546
1615
  :param runtime: The runtime environment. Only runtimes of the Node.js family are supported. Default: ``Runtime.NODEJS_LATEST`` if the ``@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion`` feature flag is enabled, otherwise ``Runtime.NODEJS_16_X``
1547
1616
  :param adot_instrumentation: Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation. Default: - No ADOT instrumentation
1548
1617
  :param allow_all_outbound: Whether to allow the Lambda to send all network traffic. If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets. Do not specify this property if the ``securityGroups`` or ``securityGroup`` property is set. Instead, configure ``allowAllOutbound`` directly on the security group. Default: true
1549
1618
  :param allow_public_subnet: Lambda Functions in a public subnet can NOT access the internet. Use this property to acknowledge this limitation and still place the function in a public subnet. Default: false
1550
- :param application_log_level: Sets the application log level for the function. Default: "INFO"
1619
+ :param application_log_level: (deprecated) Sets the application log level for the function. Default: "INFO"
1620
+ :param application_log_level_v2: Sets the application log level for the function. Default: ApplicationLogLevel.INFO
1551
1621
  :param architecture: The system architectures compatible with this lambda function. Default: Architecture.X86_64
1552
1622
  :param code_signing_config: Code signing config associated with this function. Default: - Not Sign the Code
1553
1623
  :param current_version_options: Options for the ``lambda.Version`` resource automatically created by the ``fn.currentVersion`` method. Default: - default options as described in ``VersionOptions``
@@ -1565,7 +1635,7 @@ class NodejsFunction(
1565
1635
  :param insights_version: Specify the version of CloudWatch Lambda insights to use for monitoring. Default: - No Lambda Insights
1566
1636
  :param ipv6_allowed_for_dual_stack: Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets. Only used if 'vpc' is supplied. Default: false
1567
1637
  :param layers: A list of layers to add to the function's execution environment. You can configure your Lambda function to pull in additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies that can be used by multiple functions. Default: - No layers.
1568
- :param log_format: Sets the logFormat for the function. Default: "Text"
1638
+ :param log_format: (deprecated) Sets the logFormat for the function. Default: "Text"
1569
1639
  :param logging_format: Sets the loggingFormat for the function. Default: LoggingFormat.TEXT
1570
1640
  :param log_group: The log group the function sends logs to. By default, Lambda functions send logs to an automatically created default log group named /aws/lambda/<function name>. However you cannot change the properties of this auto-created log group using the AWS CDK, e.g. you cannot set a different log retention. Use the ``logGroup`` property to create a fully customizable LogGroup ahead of time, and instruct the Lambda function to send logs to it. Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first. Default: ``/aws/lambda/${this.functionName}`` - default log group created by Lambda
1571
1641
  :param log_retention: The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to ``INFINITE``. This is a legacy API and we strongly recommend you move away from it if you can. Instead create a fully customizable log group with ``logs.LogGroup`` and use the ``logGroup`` property to instruct the Lambda function to send logs to it. Migrating from ``logRetention`` to ``logGroup`` will cause the name of the log group to change. Users and code and referencing the name verbatim will have to adjust. In AWS CDK code, you can access the log group name directly from the LogGroup construct:: import * as logs from 'aws-cdk-lib/aws-logs'; declare const myLogGroup: logs.LogGroup; myLogGroup.logGroupName; Default: logs.RetentionDays.INFINITE
@@ -1580,7 +1650,8 @@ class NodejsFunction(
1580
1650
  :param runtime_management_mode: Sets the runtime management configuration for a function's version. Default: Auto
1581
1651
  :param security_groups: The list of security groups to associate with the Lambda's network interfaces. Only used if 'vpc' is supplied. Default: - If the function is placed within a VPC and a security group is not specified, either by this or securityGroup prop, a dedicated security group will be created for this function.
1582
1652
  :param snap_start: Enable SnapStart for Lambda Function. SnapStart is currently supported only for Java 11, 17 runtime Default: - No snapstart
1583
- :param system_log_level: Sets the system log level for the function. Default: "INFO"
1653
+ :param system_log_level: (deprecated) Sets the system log level for the function. Default: "INFO"
1654
+ :param system_log_level_v2: Sets the system log level for the function. Default: SystemLogLevel.INFO
1584
1655
  :param timeout: The function execution time (in seconds) after which Lambda terminates the function. Because the execution time affects cost, set this value based on the function's expected execution time. Default: Duration.seconds(3)
1585
1656
  :param tracing: Enable AWS X-Ray Tracing for Lambda Function. Default: Tracing.Disabled
1586
1657
  :param vpc: VPC network to place Lambda network interfaces. Specify this if the Lambda function needs to access resources in a VPC. This is required when ``vpcSubnets`` is specified. Default: - Function is not placed within a VPC.
@@ -1597,6 +1668,7 @@ class NodejsFunction(
1597
1668
  props = NodejsFunctionProps(
1598
1669
  aws_sdk_connection_reuse=aws_sdk_connection_reuse,
1599
1670
  bundling=bundling,
1671
+ code=code,
1600
1672
  deps_lock_file_path=deps_lock_file_path,
1601
1673
  entry=entry,
1602
1674
  handler=handler,
@@ -1606,6 +1678,7 @@ class NodejsFunction(
1606
1678
  allow_all_outbound=allow_all_outbound,
1607
1679
  allow_public_subnet=allow_public_subnet,
1608
1680
  application_log_level=application_log_level,
1681
+ application_log_level_v2=application_log_level_v2,
1609
1682
  architecture=architecture,
1610
1683
  code_signing_config=code_signing_config,
1611
1684
  current_version_options=current_version_options,
@@ -1639,6 +1712,7 @@ class NodejsFunction(
1639
1712
  security_groups=security_groups,
1640
1713
  snap_start=snap_start,
1641
1714
  system_log_level=system_log_level,
1715
+ system_log_level_v2=system_log_level_v2,
1642
1716
  timeout=timeout,
1643
1717
  tracing=tracing,
1644
1718
  vpc=vpc,
@@ -1664,6 +1738,7 @@ class NodejsFunction(
1664
1738
  "allow_all_outbound": "allowAllOutbound",
1665
1739
  "allow_public_subnet": "allowPublicSubnet",
1666
1740
  "application_log_level": "applicationLogLevel",
1741
+ "application_log_level_v2": "applicationLogLevelV2",
1667
1742
  "architecture": "architecture",
1668
1743
  "code_signing_config": "codeSigningConfig",
1669
1744
  "current_version_options": "currentVersionOptions",
@@ -1697,12 +1772,14 @@ class NodejsFunction(
1697
1772
  "security_groups": "securityGroups",
1698
1773
  "snap_start": "snapStart",
1699
1774
  "system_log_level": "systemLogLevel",
1775
+ "system_log_level_v2": "systemLogLevelV2",
1700
1776
  "timeout": "timeout",
1701
1777
  "tracing": "tracing",
1702
1778
  "vpc": "vpc",
1703
1779
  "vpc_subnets": "vpcSubnets",
1704
1780
  "aws_sdk_connection_reuse": "awsSdkConnectionReuse",
1705
1781
  "bundling": "bundling",
1782
+ "code": "code",
1706
1783
  "deps_lock_file_path": "depsLockFilePath",
1707
1784
  "entry": "entry",
1708
1785
  "handler": "handler",
@@ -1722,6 +1799,7 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1722
1799
  allow_all_outbound: typing.Optional[builtins.bool] = None,
1723
1800
  allow_public_subnet: typing.Optional[builtins.bool] = None,
1724
1801
  application_log_level: typing.Optional[builtins.str] = None,
1802
+ application_log_level_v2: typing.Optional[_ApplicationLogLevel_cd92660a] = None,
1725
1803
  architecture: typing.Optional[_Architecture_12d5a53f] = None,
1726
1804
  code_signing_config: typing.Optional[_ICodeSigningConfig_edb41d1f] = None,
1727
1805
  current_version_options: typing.Optional[typing.Union[_VersionOptions_981bb3c0, typing.Dict[builtins.str, typing.Any]]] = None,
@@ -1755,12 +1833,14 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1755
1833
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
1756
1834
  snap_start: typing.Optional[_SnapStartConf_2ffaa769] = None,
1757
1835
  system_log_level: typing.Optional[builtins.str] = None,
1836
+ system_log_level_v2: typing.Optional[_SystemLogLevel_aea49dc2] = None,
1758
1837
  timeout: typing.Optional[_Duration_4839e8c3] = None,
1759
1838
  tracing: typing.Optional[_Tracing_9fe8e2bb] = None,
1760
1839
  vpc: typing.Optional[_IVpc_f30d5663] = None,
1761
1840
  vpc_subnets: typing.Optional[typing.Union[_SubnetSelection_e57d76df, typing.Dict[builtins.str, typing.Any]]] = None,
1762
1841
  aws_sdk_connection_reuse: typing.Optional[builtins.bool] = None,
1763
1842
  bundling: typing.Optional[typing.Union[BundlingOptions, typing.Dict[builtins.str, typing.Any]]] = None,
1843
+ code: typing.Optional[_Code_7848f942] = None,
1764
1844
  deps_lock_file_path: typing.Optional[builtins.str] = None,
1765
1845
  entry: typing.Optional[builtins.str] = None,
1766
1846
  handler: typing.Optional[builtins.str] = None,
@@ -1776,7 +1856,8 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1776
1856
  :param adot_instrumentation: Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation. Default: - No ADOT instrumentation
1777
1857
  :param allow_all_outbound: Whether to allow the Lambda to send all network traffic. If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets. Do not specify this property if the ``securityGroups`` or ``securityGroup`` property is set. Instead, configure ``allowAllOutbound`` directly on the security group. Default: true
1778
1858
  :param allow_public_subnet: Lambda Functions in a public subnet can NOT access the internet. Use this property to acknowledge this limitation and still place the function in a public subnet. Default: false
1779
- :param application_log_level: Sets the application log level for the function. Default: "INFO"
1859
+ :param application_log_level: (deprecated) Sets the application log level for the function. Default: "INFO"
1860
+ :param application_log_level_v2: Sets the application log level for the function. Default: ApplicationLogLevel.INFO
1780
1861
  :param architecture: The system architectures compatible with this lambda function. Default: Architecture.X86_64
1781
1862
  :param code_signing_config: Code signing config associated with this function. Default: - Not Sign the Code
1782
1863
  :param current_version_options: Options for the ``lambda.Version`` resource automatically created by the ``fn.currentVersion`` method. Default: - default options as described in ``VersionOptions``
@@ -1794,7 +1875,7 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1794
1875
  :param insights_version: Specify the version of CloudWatch Lambda insights to use for monitoring. Default: - No Lambda Insights
1795
1876
  :param ipv6_allowed_for_dual_stack: Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets. Only used if 'vpc' is supplied. Default: false
1796
1877
  :param layers: A list of layers to add to the function's execution environment. You can configure your Lambda function to pull in additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies that can be used by multiple functions. Default: - No layers.
1797
- :param log_format: Sets the logFormat for the function. Default: "Text"
1878
+ :param log_format: (deprecated) Sets the logFormat for the function. Default: "Text"
1798
1879
  :param logging_format: Sets the loggingFormat for the function. Default: LoggingFormat.TEXT
1799
1880
  :param log_group: The log group the function sends logs to. By default, Lambda functions send logs to an automatically created default log group named /aws/lambda/<function name>. However you cannot change the properties of this auto-created log group using the AWS CDK, e.g. you cannot set a different log retention. Use the ``logGroup`` property to create a fully customizable LogGroup ahead of time, and instruct the Lambda function to send logs to it. Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first. Default: ``/aws/lambda/${this.functionName}`` - default log group created by Lambda
1800
1881
  :param log_retention: The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to ``INFINITE``. This is a legacy API and we strongly recommend you move away from it if you can. Instead create a fully customizable log group with ``logs.LogGroup`` and use the ``logGroup`` property to instruct the Lambda function to send logs to it. Migrating from ``logRetention`` to ``logGroup`` will cause the name of the log group to change. Users and code and referencing the name verbatim will have to adjust. In AWS CDK code, you can access the log group name directly from the LogGroup construct:: import * as logs from 'aws-cdk-lib/aws-logs'; declare const myLogGroup: logs.LogGroup; myLogGroup.logGroupName; Default: logs.RetentionDays.INFINITE
@@ -1809,16 +1890,18 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1809
1890
  :param runtime_management_mode: Sets the runtime management configuration for a function's version. Default: Auto
1810
1891
  :param security_groups: The list of security groups to associate with the Lambda's network interfaces. Only used if 'vpc' is supplied. Default: - If the function is placed within a VPC and a security group is not specified, either by this or securityGroup prop, a dedicated security group will be created for this function.
1811
1892
  :param snap_start: Enable SnapStart for Lambda Function. SnapStart is currently supported only for Java 11, 17 runtime Default: - No snapstart
1812
- :param system_log_level: Sets the system log level for the function. Default: "INFO"
1893
+ :param system_log_level: (deprecated) Sets the system log level for the function. Default: "INFO"
1894
+ :param system_log_level_v2: Sets the system log level for the function. Default: SystemLogLevel.INFO
1813
1895
  :param timeout: The function execution time (in seconds) after which Lambda terminates the function. Because the execution time affects cost, set this value based on the function's expected execution time. Default: Duration.seconds(3)
1814
1896
  :param tracing: Enable AWS X-Ray Tracing for Lambda Function. Default: Tracing.Disabled
1815
1897
  :param vpc: VPC network to place Lambda network interfaces. Specify this if the Lambda function needs to access resources in a VPC. This is required when ``vpcSubnets`` is specified. Default: - Function is not placed within a VPC.
1816
1898
  :param vpc_subnets: Where to place the network interfaces within the VPC. This requires ``vpc`` to be specified in order for interfaces to actually be placed in the subnets. If ``vpc`` is not specify, this will raise an error. Note: Internet access for Lambda Functions requires a NAT Gateway, so picking public subnets is not allowed (unless ``allowPublicSubnet`` is set to ``true``). Default: - the Vpc default strategy if not specified
1817
1899
  :param aws_sdk_connection_reuse: The ``AWS_NODEJS_CONNECTION_REUSE_ENABLED`` environment variable does not exist in the AWS SDK for JavaScript v3. This prop will be deprecated when the Lambda Node16 runtime is deprecated on June 12, 2024. See https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-support-policy Info for Node 16 runtimes / SDK v2 users: Whether to automatically reuse TCP connections when working with the AWS SDK for JavaScript v2. This sets the ``AWS_NODEJS_CONNECTION_REUSE_ENABLED`` environment variable to ``1``. Default: - false (obsolete) for runtimes >= Node 18, true for runtimes <= Node 16.
1818
1900
  :param bundling: Bundling options. Default: - use default bundling options: no minify, no sourcemap, all modules are bundled.
1901
+ :param code: The code that will be deployed to the Lambda Handler. If included, then properties related to bundling of the code are ignored. - If the ``code`` field is specified, then you must include the ``handler`` property. Default: - the code is bundled by esbuild
1819
1902
  :param deps_lock_file_path: The path to the dependencies lock file (``yarn.lock``, ``pnpm-lock.yaml`` or ``package-lock.json``). This will be used as the source for the volume mounted in the Docker container. Modules specified in ``nodeModules`` will be installed using the right installer (``yarn``, ``pnpm`` or ``npm``) along with this lock file. Default: - the path is found by walking up parent directories searching for a ``yarn.lock``, ``pnpm-lock.yaml`` or ``package-lock.json`` file
1820
1903
  :param entry: Path to the entry file (JavaScript or TypeScript). Default: - Derived from the name of the defining file and the construct's id. If the ``NodejsFunction`` is defined in ``stack.ts`` with ``my-handler`` as id (``new NodejsFunction(this, 'my-handler')``), the construct will look at ``stack.my-handler.ts`` and ``stack.my-handler.js``.
1821
- :param handler: The name of the exported handler in the entry file. The handler is prefixed with ``index.`` unless the specified handler value contains a ``.``, in which case it is used as-is. Default: handler
1904
+ :param handler: The name of the exported handler in the entry file. - If the ``code`` property is supplied, then you must include the ``handler`` property. The handler should be the name of the file that contains the exported handler and the function that should be called when the AWS Lambda is invoked. For example, if you had a file called ``myLambda.js`` and the function to be invoked was ``myHandler``, then you should input ``handler`` property as ``myLambda.myHandler``. - If the ``code`` property is not supplied and the handler input does not contain a ``.``, then the handler is prefixed with ``index.`` (index period). Otherwise, the handler property is not modified. Default: handler
1822
1905
  :param project_root: The path to the directory containing project config files (``package.json`` or ``tsconfig.json``). Default: - the directory containing the ``depsLockFilePath``
1823
1906
  :param runtime: The runtime environment. Only runtimes of the Node.js family are supported. Default: ``Runtime.NODEJS_LATEST`` if the ``@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion`` feature flag is enabled, otherwise ``Runtime.NODEJS_16_X``
1824
1907
 
@@ -1856,6 +1939,7 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1856
1939
  check_type(argname="argument allow_all_outbound", value=allow_all_outbound, expected_type=type_hints["allow_all_outbound"])
1857
1940
  check_type(argname="argument allow_public_subnet", value=allow_public_subnet, expected_type=type_hints["allow_public_subnet"])
1858
1941
  check_type(argname="argument application_log_level", value=application_log_level, expected_type=type_hints["application_log_level"])
1942
+ check_type(argname="argument application_log_level_v2", value=application_log_level_v2, expected_type=type_hints["application_log_level_v2"])
1859
1943
  check_type(argname="argument architecture", value=architecture, expected_type=type_hints["architecture"])
1860
1944
  check_type(argname="argument code_signing_config", value=code_signing_config, expected_type=type_hints["code_signing_config"])
1861
1945
  check_type(argname="argument current_version_options", value=current_version_options, expected_type=type_hints["current_version_options"])
@@ -1889,12 +1973,14 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1889
1973
  check_type(argname="argument security_groups", value=security_groups, expected_type=type_hints["security_groups"])
1890
1974
  check_type(argname="argument snap_start", value=snap_start, expected_type=type_hints["snap_start"])
1891
1975
  check_type(argname="argument system_log_level", value=system_log_level, expected_type=type_hints["system_log_level"])
1976
+ check_type(argname="argument system_log_level_v2", value=system_log_level_v2, expected_type=type_hints["system_log_level_v2"])
1892
1977
  check_type(argname="argument timeout", value=timeout, expected_type=type_hints["timeout"])
1893
1978
  check_type(argname="argument tracing", value=tracing, expected_type=type_hints["tracing"])
1894
1979
  check_type(argname="argument vpc", value=vpc, expected_type=type_hints["vpc"])
1895
1980
  check_type(argname="argument vpc_subnets", value=vpc_subnets, expected_type=type_hints["vpc_subnets"])
1896
1981
  check_type(argname="argument aws_sdk_connection_reuse", value=aws_sdk_connection_reuse, expected_type=type_hints["aws_sdk_connection_reuse"])
1897
1982
  check_type(argname="argument bundling", value=bundling, expected_type=type_hints["bundling"])
1983
+ check_type(argname="argument code", value=code, expected_type=type_hints["code"])
1898
1984
  check_type(argname="argument deps_lock_file_path", value=deps_lock_file_path, expected_type=type_hints["deps_lock_file_path"])
1899
1985
  check_type(argname="argument entry", value=entry, expected_type=type_hints["entry"])
1900
1986
  check_type(argname="argument handler", value=handler, expected_type=type_hints["handler"])
@@ -1917,6 +2003,8 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1917
2003
  self._values["allow_public_subnet"] = allow_public_subnet
1918
2004
  if application_log_level is not None:
1919
2005
  self._values["application_log_level"] = application_log_level
2006
+ if application_log_level_v2 is not None:
2007
+ self._values["application_log_level_v2"] = application_log_level_v2
1920
2008
  if architecture is not None:
1921
2009
  self._values["architecture"] = architecture
1922
2010
  if code_signing_config is not None:
@@ -1983,6 +2071,8 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1983
2071
  self._values["snap_start"] = snap_start
1984
2072
  if system_log_level is not None:
1985
2073
  self._values["system_log_level"] = system_log_level
2074
+ if system_log_level_v2 is not None:
2075
+ self._values["system_log_level_v2"] = system_log_level_v2
1986
2076
  if timeout is not None:
1987
2077
  self._values["timeout"] = timeout
1988
2078
  if tracing is not None:
@@ -1995,6 +2085,8 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
1995
2085
  self._values["aws_sdk_connection_reuse"] = aws_sdk_connection_reuse
1996
2086
  if bundling is not None:
1997
2087
  self._values["bundling"] = bundling
2088
+ if code is not None:
2089
+ self._values["code"] = code
1998
2090
  if deps_lock_file_path is not None:
1999
2091
  self._values["deps_lock_file_path"] = deps_lock_file_path
2000
2092
  if entry is not None:
@@ -2091,13 +2183,28 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
2091
2183
 
2092
2184
  @builtins.property
2093
2185
  def application_log_level(self) -> typing.Optional[builtins.str]:
2094
- '''Sets the application log level for the function.
2186
+ '''(deprecated) Sets the application log level for the function.
2095
2187
 
2096
2188
  :default: "INFO"
2189
+
2190
+ :deprecated: Use ``applicationLogLevelV2`` as a property instead.
2191
+
2192
+ :stability: deprecated
2097
2193
  '''
2098
2194
  result = self._values.get("application_log_level")
2099
2195
  return typing.cast(typing.Optional[builtins.str], result)
2100
2196
 
2197
+ @builtins.property
2198
+ def application_log_level_v2(
2199
+ self,
2200
+ ) -> typing.Optional[_ApplicationLogLevel_cd92660a]:
2201
+ '''Sets the application log level for the function.
2202
+
2203
+ :default: ApplicationLogLevel.INFO
2204
+ '''
2205
+ result = self._values.get("application_log_level_v2")
2206
+ return typing.cast(typing.Optional[_ApplicationLogLevel_cd92660a], result)
2207
+
2101
2208
  @builtins.property
2102
2209
  def architecture(self) -> typing.Optional[_Architecture_12d5a53f]:
2103
2210
  '''The system architectures compatible with this lambda function.
@@ -2282,9 +2389,13 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
2282
2389
 
2283
2390
  @builtins.property
2284
2391
  def log_format(self) -> typing.Optional[builtins.str]:
2285
- '''Sets the logFormat for the function.
2392
+ '''(deprecated) Sets the logFormat for the function.
2286
2393
 
2287
2394
  :default: "Text"
2395
+
2396
+ :deprecated: Use ``loggingFormat`` as a property instead.
2397
+
2398
+ :stability: deprecated
2288
2399
  '''
2289
2400
  result = self._values.get("log_format")
2290
2401
  return typing.cast(typing.Optional[builtins.str], result)
@@ -2490,13 +2601,26 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
2490
2601
 
2491
2602
  @builtins.property
2492
2603
  def system_log_level(self) -> typing.Optional[builtins.str]:
2493
- '''Sets the system log level for the function.
2604
+ '''(deprecated) Sets the system log level for the function.
2494
2605
 
2495
2606
  :default: "INFO"
2607
+
2608
+ :deprecated: Use ``systemLogLevelV2`` as a property instead.
2609
+
2610
+ :stability: deprecated
2496
2611
  '''
2497
2612
  result = self._values.get("system_log_level")
2498
2613
  return typing.cast(typing.Optional[builtins.str], result)
2499
2614
 
2615
+ @builtins.property
2616
+ def system_log_level_v2(self) -> typing.Optional[_SystemLogLevel_aea49dc2]:
2617
+ '''Sets the system log level for the function.
2618
+
2619
+ :default: SystemLogLevel.INFO
2620
+ '''
2621
+ result = self._values.get("system_log_level_v2")
2622
+ return typing.cast(typing.Optional[_SystemLogLevel_aea49dc2], result)
2623
+
2500
2624
  @builtins.property
2501
2625
  def timeout(self) -> typing.Optional[_Duration_4839e8c3]:
2502
2626
  '''The function execution time (in seconds) after which Lambda terminates the function.
@@ -2579,6 +2703,20 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
2579
2703
  result = self._values.get("bundling")
2580
2704
  return typing.cast(typing.Optional[BundlingOptions], result)
2581
2705
 
2706
+ @builtins.property
2707
+ def code(self) -> typing.Optional[_Code_7848f942]:
2708
+ '''The code that will be deployed to the Lambda Handler.
2709
+
2710
+ If included, then properties related to
2711
+ bundling of the code are ignored.
2712
+
2713
+ - If the ``code`` field is specified, then you must include the ``handler`` property.
2714
+
2715
+ :default: - the code is bundled by esbuild
2716
+ '''
2717
+ result = self._values.get("code")
2718
+ return typing.cast(typing.Optional[_Code_7848f942], result)
2719
+
2582
2720
  @builtins.property
2583
2721
  def deps_lock_file_path(self) -> typing.Optional[builtins.str]:
2584
2722
  '''The path to the dependencies lock file (``yarn.lock``, ``pnpm-lock.yaml`` or ``package-lock.json``).
@@ -2615,8 +2753,11 @@ class NodejsFunctionProps(_FunctionOptions_328f4d39):
2615
2753
  def handler(self) -> typing.Optional[builtins.str]:
2616
2754
  '''The name of the exported handler in the entry file.
2617
2755
 
2618
- The handler is prefixed with ``index.`` unless the specified handler value contains a ``.``,
2619
- in which case it is used as-is.
2756
+ - If the ``code`` property is supplied, then you must include the ``handler`` property. The handler should be the name of the file
2757
+ that contains the exported handler and the function that should be called when the AWS Lambda is invoked. For example, if
2758
+ you had a file called ``myLambda.js`` and the function to be invoked was ``myHandler``, then you should input ``handler`` property as ``myLambda.myHandler``.
2759
+ - If the ``code`` property is not supplied and the handler input does not contain a ``.``, then the handler is prefixed with ``index.`` (index period). Otherwise,
2760
+ the handler property is not modified.
2620
2761
 
2621
2762
  :default: handler
2622
2763
  '''
@@ -2837,6 +2978,7 @@ def _typecheckingstub__ece177829b26ef102d4080d730f168e29d7d310d1518738839cd3fc82
2837
2978
  *,
2838
2979
  aws_sdk_connection_reuse: typing.Optional[builtins.bool] = None,
2839
2980
  bundling: typing.Optional[typing.Union[BundlingOptions, typing.Dict[builtins.str, typing.Any]]] = None,
2981
+ code: typing.Optional[_Code_7848f942] = None,
2840
2982
  deps_lock_file_path: typing.Optional[builtins.str] = None,
2841
2983
  entry: typing.Optional[builtins.str] = None,
2842
2984
  handler: typing.Optional[builtins.str] = None,
@@ -2846,6 +2988,7 @@ def _typecheckingstub__ece177829b26ef102d4080d730f168e29d7d310d1518738839cd3fc82
2846
2988
  allow_all_outbound: typing.Optional[builtins.bool] = None,
2847
2989
  allow_public_subnet: typing.Optional[builtins.bool] = None,
2848
2990
  application_log_level: typing.Optional[builtins.str] = None,
2991
+ application_log_level_v2: typing.Optional[_ApplicationLogLevel_cd92660a] = None,
2849
2992
  architecture: typing.Optional[_Architecture_12d5a53f] = None,
2850
2993
  code_signing_config: typing.Optional[_ICodeSigningConfig_edb41d1f] = None,
2851
2994
  current_version_options: typing.Optional[typing.Union[_VersionOptions_981bb3c0, typing.Dict[builtins.str, typing.Any]]] = None,
@@ -2879,6 +3022,7 @@ def _typecheckingstub__ece177829b26ef102d4080d730f168e29d7d310d1518738839cd3fc82
2879
3022
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
2880
3023
  snap_start: typing.Optional[_SnapStartConf_2ffaa769] = None,
2881
3024
  system_log_level: typing.Optional[builtins.str] = None,
3025
+ system_log_level_v2: typing.Optional[_SystemLogLevel_aea49dc2] = None,
2882
3026
  timeout: typing.Optional[_Duration_4839e8c3] = None,
2883
3027
  tracing: typing.Optional[_Tracing_9fe8e2bb] = None,
2884
3028
  vpc: typing.Optional[_IVpc_f30d5663] = None,
@@ -2901,6 +3045,7 @@ def _typecheckingstub__2da45b394f0332be0f6d6b7468d9fb54961953d56265da69955d36ffa
2901
3045
  allow_all_outbound: typing.Optional[builtins.bool] = None,
2902
3046
  allow_public_subnet: typing.Optional[builtins.bool] = None,
2903
3047
  application_log_level: typing.Optional[builtins.str] = None,
3048
+ application_log_level_v2: typing.Optional[_ApplicationLogLevel_cd92660a] = None,
2904
3049
  architecture: typing.Optional[_Architecture_12d5a53f] = None,
2905
3050
  code_signing_config: typing.Optional[_ICodeSigningConfig_edb41d1f] = None,
2906
3051
  current_version_options: typing.Optional[typing.Union[_VersionOptions_981bb3c0, typing.Dict[builtins.str, typing.Any]]] = None,
@@ -2934,12 +3079,14 @@ def _typecheckingstub__2da45b394f0332be0f6d6b7468d9fb54961953d56265da69955d36ffa
2934
3079
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
2935
3080
  snap_start: typing.Optional[_SnapStartConf_2ffaa769] = None,
2936
3081
  system_log_level: typing.Optional[builtins.str] = None,
3082
+ system_log_level_v2: typing.Optional[_SystemLogLevel_aea49dc2] = None,
2937
3083
  timeout: typing.Optional[_Duration_4839e8c3] = None,
2938
3084
  tracing: typing.Optional[_Tracing_9fe8e2bb] = None,
2939
3085
  vpc: typing.Optional[_IVpc_f30d5663] = None,
2940
3086
  vpc_subnets: typing.Optional[typing.Union[_SubnetSelection_e57d76df, typing.Dict[builtins.str, typing.Any]]] = None,
2941
3087
  aws_sdk_connection_reuse: typing.Optional[builtins.bool] = None,
2942
3088
  bundling: typing.Optional[typing.Union[BundlingOptions, typing.Dict[builtins.str, typing.Any]]] = None,
3089
+ code: typing.Optional[_Code_7848f942] = None,
2943
3090
  deps_lock_file_path: typing.Optional[builtins.str] = None,
2944
3091
  entry: typing.Optional[builtins.str] = None,
2945
3092
  handler: typing.Optional[builtins.str] = None,