konokenj.cdk-api-mcp-server 0.51.0__py3-none-any.whl → 0.53.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 konokenj.cdk-api-mcp-server might be problematic. Click here for more details.

Files changed (46) hide show
  1. cdk_api_mcp_server/__about__.py +1 -1
  2. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +325 -3
  3. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-lambda-go-alpha/README.md +102 -4
  4. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/README.md +9 -0
  5. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.spec-restapi.ts +1 -0
  6. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/README.md +93 -81
  7. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.stage.ts +20 -4
  8. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md +0 -1
  9. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.managed-policy.ts +9 -0
  10. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.policy.ts +9 -0
  11. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/README.md +60 -3
  12. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.cloudwatch-logs-processors.ts +45 -0
  13. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.fromasset.ts +19 -4
  14. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.inlinecode.ts +7 -0
  15. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/README.md +65 -4
  16. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-big-response.ts +13 -6
  17. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cloudfront.ts +20 -18
  18. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-nested-stack-source.ts +7 -1
  19. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-source.ts +6 -1
  20. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-ssm-source.ts +7 -1
  21. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-data.ts +83 -62
  22. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-deployed-bucket.ts +10 -4
  23. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-large-file.ts +20 -12
  24. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-loggroup.ts +7 -2
  25. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-efs.ts +77 -0
  26. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-empty.ts +69 -0
  27. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-multiple.ts +89 -0
  28. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-single.ts +77 -0
  29. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-signcontent.ts +11 -7
  30. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-destination-key.ts +15 -8
  31. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-role.ts +29 -14
  32. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution.ts +16 -8
  33. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-basic.ts +65 -0
  34. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-config.ts +66 -0
  35. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-custom-subnets.ts +66 -0
  36. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-efs.ts +66 -0
  37. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-security-groups.ts +72 -0
  38. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-subnet-selection.ts +70 -0
  39. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment.ts +47 -69
  40. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.sm-jsonpath-with-distributed-map-jsonata.ts +105 -0
  41. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +11 -11
  42. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/METADATA +2 -2
  43. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/RECORD +46 -34
  44. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/WHEEL +0 -0
  45. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/entry_points.txt +0 -0
  46. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -14,11 +14,13 @@
14
14
  - [VPC Link](#vpc-link)
15
15
  - [Private Integration](#private-integration)
16
16
  - [Generating ARN for Execute API](#generating-arn-for-execute-api)
17
- - [Access Logging](#access-logging)
18
17
  - [WebSocket API](#websocket-api)
19
18
  - [Manage Connections Permission](#manage-connections-permission)
20
19
  - [Managing access to WebSocket APIs](#managing-access-to-websocket-apis)
21
20
  - [Usage Plan and API Keys](#usage-plan-and-api-keys)
21
+ - [Common Config](#common-config)
22
+ - [Route Settings](#route-settings)
23
+ - [Access Logging](#access-logging)
22
24
 
23
25
  ## Introduction
24
26
 
@@ -375,65 +377,6 @@ const arn = api.arnForExecuteApi('GET', '/myApiPath', 'dev');
375
377
  - The 'ANY' method can be used for matching any HTTP methods not explicitly defined.
376
378
  - The function gracefully handles undefined parameters by using wildcards, making it flexible for various API configurations.
377
379
 
378
- ## Access Logging
379
-
380
- You can turn on logging to write logs to CloudWatch Logs.
381
- Read more at [Configure logging for HTTP APIs in API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging.html)
382
-
383
- ```ts
384
- import * as logs from 'aws-cdk-lib/aws-logs';
385
-
386
- declare const api: apigwv2.HttpApi;
387
- declare const logGroup: logs.LogGroup;
388
-
389
- const stage = new apigwv2.HttpStage(this, 'Stage', {
390
- httpApi: api,
391
- accessLogSettings: {
392
- destination: new apigwv2.LogGroupLogDestination(logGroup),
393
- },
394
- });
395
- ```
396
-
397
- The following code will generate the access log in the [CLF format](https://en.wikipedia.org/wiki/Common_Log_Format).
398
-
399
- ```ts
400
- import * as apigw from 'aws-cdk-lib/aws-apigateway';
401
- import * as logs from 'aws-cdk-lib/aws-logs';
402
-
403
- declare const api: apigwv2.HttpApi;
404
- declare const logGroup: logs.LogGroup;
405
-
406
- const stage = new apigwv2.HttpStage(this, 'Stage', {
407
- httpApi: api,
408
- accessLogSettings: {
409
- destination: new apigwv2.LogGroupLogDestination(logGroup),
410
- format: apigw.AccessLogFormat.clf(),
411
- },
412
- });
413
- ```
414
-
415
- You can also configure your own access log format by using the `AccessLogFormat.custom()` API.
416
- `AccessLogField` provides commonly used fields. The following code configures access log to contain.
417
-
418
- ```ts
419
- import * as apigw from 'aws-cdk-lib/aws-apigateway';
420
- import * as logs from 'aws-cdk-lib/aws-logs';
421
-
422
- declare const api: apigwv2.HttpApi;
423
- declare const logGroup: logs.LogGroup;
424
-
425
- const stage = new apigwv2.HttpStage(this, 'Stage', {
426
- httpApi: api,
427
- accessLogSettings: {
428
- destination: new apigwv2.LogGroupLogDestination(logGroup),
429
- format: apigw.AccessLogFormat.custom(
430
- `${apigw.AccessLogField.contextRequestId()} ${apigw.AccessLogField.contextErrorMessage()} ${apigw.AccessLogField.contextErrorMessageString()}
431
- ${apigw.AccessLogField.contextAuthorizerError()} ${apigw.AccessLogField.contextAuthorizerIntegrationStatus()}`
432
- ),
433
- },
434
- });
435
- ```
436
-
437
380
  ## WebSocket API
438
381
 
439
382
  A WebSocket API in API Gateway is a collection of WebSocket routes that are integrated with backend HTTP endpoints,
@@ -578,26 +521,6 @@ const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi',{
578
521
  });
579
522
  ```
580
523
 
581
- ## Common Config
582
-
583
- Common config for both HTTP API and WebSocket API
584
-
585
- ### Route Settings
586
-
587
- Represents a collection of route settings.
588
-
589
- ```ts
590
- declare const api: apigwv2.HttpApi;
591
-
592
- new apigwv2.HttpStage(this, 'Stage', {
593
- httpApi: api,
594
- throttle: {
595
- rateLimit: 1000,
596
- burstLimit: 1000,
597
- },
598
- detailedMetricsEnabled: true,
599
- });
600
- ```
601
524
  ## Usage Plan and API Keys
602
525
 
603
526
  A usage plan specifies who can access one or more deployed WebSocket API stages, and the rate at which they can be accessed. The plan uses API keys to
@@ -740,4 +663,93 @@ const key = new apigwv2.RateLimitedApiKey(this, 'rate-limited-api-key', {
740
663
  burstLimit: 200
741
664
  }
742
665
  });
743
- ```
666
+ ```
667
+
668
+ ## Common Config
669
+
670
+ Common config for both HTTP API and WebSocket API
671
+
672
+ ### Route Settings
673
+
674
+ Represents a collection of route settings.
675
+
676
+ ```ts
677
+ declare const api: apigwv2.HttpApi;
678
+
679
+ new apigwv2.HttpStage(this, 'Stage', {
680
+ httpApi: api,
681
+ throttle: {
682
+ rateLimit: 1000,
683
+ burstLimit: 1000,
684
+ },
685
+ detailedMetricsEnabled: true,
686
+ });
687
+ ```
688
+
689
+ ### Access Logging
690
+
691
+ You can turn on logging to write logs to CloudWatch Logs.
692
+ Read more at Configure logging for [HTTP APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging.html) or [WebSocket APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-logging.html)
693
+
694
+ ```ts
695
+ import * as logs from 'aws-cdk-lib/aws-logs';
696
+
697
+ declare const httpApi: apigwv2.HttpApi;
698
+ declare const webSocketApi : apigwv2.WebSocketApi;
699
+ declare const logGroup: logs.LogGroup;
700
+
701
+ new apigwv2.HttpStage(this, 'HttpStage', {
702
+ httpApi,
703
+ accessLogSettings: {
704
+ destination: new apigwv2.LogGroupLogDestination(logGroup),
705
+ },
706
+ });
707
+
708
+ new apigwv2.WebSocketStage(this, 'WebSocketStage', {
709
+ webSocketApi,
710
+ stageName: 'dev',
711
+ accessLogSettings: {
712
+ destination: new apigwv2.LogGroupLogDestination(logGroup),
713
+ },
714
+ });
715
+ ```
716
+
717
+ The following code will generate the access log in the [CLF format](https://en.wikipedia.org/wiki/Common_Log_Format).
718
+
719
+ ```ts
720
+ import * as apigw from 'aws-cdk-lib/aws-apigateway';
721
+ import * as logs from 'aws-cdk-lib/aws-logs';
722
+
723
+ declare const api: apigwv2.HttpApi;
724
+ declare const logGroup: logs.LogGroup;
725
+
726
+ const stage = new apigwv2.HttpStage(this, 'Stage', {
727
+ httpApi: api,
728
+ accessLogSettings: {
729
+ destination: new apigwv2.LogGroupLogDestination(logGroup),
730
+ format: apigw.AccessLogFormat.clf(),
731
+ },
732
+ });
733
+ ```
734
+
735
+ You can also configure your own access log format by using the `AccessLogFormat.custom()` API.
736
+ `AccessLogField` provides commonly used fields. The following code configures access log to contain.
737
+
738
+ ```ts
739
+ import * as apigw from 'aws-cdk-lib/aws-apigateway';
740
+ import * as logs from 'aws-cdk-lib/aws-logs';
741
+
742
+ declare const api: apigwv2.HttpApi;
743
+ declare const logGroup: logs.LogGroup;
744
+
745
+ const stage = new apigwv2.HttpStage(this, 'Stage', {
746
+ httpApi: api,
747
+ accessLogSettings: {
748
+ destination: new apigwv2.LogGroupLogDestination(logGroup),
749
+ format: apigw.AccessLogFormat.custom(
750
+ `${apigw.AccessLogField.contextRequestId()} ${apigw.AccessLogField.contextErrorMessage()} ${apigw.AccessLogField.contextErrorMessageString()}
751
+ ${apigw.AccessLogField.contextAuthorizerError()} ${apigw.AccessLogField.contextAuthorizerIntegrationStatus()}`
752
+ ),
753
+ },
754
+ });
755
+ ```
@@ -1,12 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ import { IntegTest } from '@aws-cdk/integ-tests-alpha';
2
3
  import * as cdk from 'aws-cdk-lib';
3
- import * as apigw from 'aws-cdk-lib/aws-apigatewayv2';
4
+ import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2';
5
+ import * as apigw from 'aws-cdk-lib/aws-apigateway';
6
+ import * as logs from 'aws-cdk-lib/aws-logs';
4
7
 
5
8
  const app = new cdk.App();
6
9
  const stack = new cdk.Stack(app, 'aws-cdk-aws-apigatewayv2-websocket-stage');
7
10
 
8
- const webSocketApi = new apigw.WebSocketApi(stack, 'WebSocketApi');
9
- new apigw.WebSocketStage(stack, 'WebSocketStage', {
11
+ const logGroup = new logs.LogGroup(stack, 'MyLogGroup', {
12
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
13
+ });
14
+
15
+ const webSocketApi = new apigwv2.WebSocketApi(stack, 'WebSocketApi');
16
+ new apigwv2.WebSocketStage(stack, 'WebSocketStage', {
10
17
  webSocketApi,
11
18
  stageName: 'dev',
12
19
  throttle: {
@@ -15,6 +22,15 @@ new apigw.WebSocketStage(stack, 'WebSocketStage', {
15
22
  },
16
23
  detailedMetricsEnabled: true,
17
24
  description: 'My Stage',
25
+ accessLogSettings: {
26
+ destination: new apigwv2.LogGroupLogDestination(logGroup),
27
+ format: apigw.AccessLogFormat.custom(JSON.stringify({
28
+ extendedRequestId: apigw.AccessLogField.contextExtendedRequestId(),
29
+ requestTime: apigw.AccessLogField.contextRequestTime(),
30
+ })),
31
+ },
18
32
  });
19
33
 
20
- app.synth();
34
+ new IntegTest(app, 'aws-cdk-aws-apigatewayv2-websocket-stage-test', {
35
+ testCases: [stack],
36
+ });
@@ -651,7 +651,6 @@ const project = new codebuild.Project(this, 'MyProject', {
651
651
  // vpc,
652
652
  });
653
653
  ```
654
- >>>>>>> 39ec36ec6a (feat(codebuild): add custom instance type and VPC to Fleets)
655
654
 
656
655
  ## Logs
657
656
 
@@ -1,6 +1,7 @@
1
1
  import { App, Stack } from 'aws-cdk-lib';
2
2
  import { IntegTest } from '@aws-cdk/integ-tests-alpha';
3
3
  import { AccountRootPrincipal, Grant, ManagedPolicy, PolicyStatement, Role, User } from 'aws-cdk-lib/aws-iam';
4
+ import * as lambda from 'aws-cdk-lib/aws-lambda';
4
5
 
5
6
  const app = new App();
6
7
 
@@ -34,6 +35,14 @@ policy.attachToRole(role);
34
35
  const importedRole = Role.fromRoleArn(stack, 'ImportedRole', role.roleArn);
35
36
  policy.attachToRole(importedRole);
36
37
 
38
+ // Can be passed to grantInvoke, see https://github.com/aws/aws-cdk/issues/32980
39
+ const func = new lambda.Function(stack, 'Function', {
40
+ runtime: lambda.Runtime.NODEJS_LATEST,
41
+ handler: 'index.handler',
42
+ code: lambda.Code.fromInline('export const handler = async () => null'),
43
+ });
44
+ func.grantInvoke(policy);
45
+
37
46
  new IntegTest(app, 'ManagedPolicyInteg', {
38
47
  testCases: [stack],
39
48
  });
@@ -1,6 +1,7 @@
1
1
  import { App, Stack } from 'aws-cdk-lib';
2
2
  import { IntegTest } from '@aws-cdk/integ-tests-alpha';
3
3
  import { AccountRootPrincipal, Grant, Policy, PolicyStatement, Role, User } from 'aws-cdk-lib/aws-iam';
4
+ import * as lambda from 'aws-cdk-lib/aws-lambda';
4
5
 
5
6
  const app = new App();
6
7
 
@@ -21,6 +22,14 @@ role.grantAssumeRole(user);
21
22
 
22
23
  Grant.addToPrincipal({ actions: ['iam:*'], resourceArns: [role.roleArn], grantee: policy2 });
23
24
 
25
+ // Can be passed to grantInvoke, see https://github.com/aws/aws-cdk/issues/32980
26
+ const func = new lambda.Function(stack, 'Function', {
27
+ runtime: lambda.Runtime.NODEJS_LATEST,
28
+ handler: 'index.handler',
29
+ code: lambda.Code.fromInline('export const handler = async () => null'),
30
+ });
31
+ func.grantInvoke(policy);
32
+
24
33
  new IntegTest(app, 'PolicyInteg', {
25
34
  testCases: [stack],
26
35
  });
@@ -483,8 +483,11 @@ Data can be transformed before being delivered to destinations. There are two ty
483
483
  data processing for delivery streams: record transformation with AWS Lambda, and record
484
484
  format conversion using a schema stored in an AWS Glue table. If both types of data
485
485
  processing are configured, then the Lambda transformation is performed first. By default,
486
- no data processing occurs. This construct library currently only supports data
487
- transformation with AWS Lambda. See [#15501](https://github.com/aws/aws-cdk/issues/15501)
486
+ no data processing occurs.
487
+
488
+ This construct library currently only supports data
489
+ transformation with AWS Lambda and some built-in data processors.
490
+ See [#15501](https://github.com/aws/aws-cdk/issues/15501)
488
491
  to track the status of adding support for record format conversion.
489
492
 
490
493
  ### Data transformation with AWS Lambda
@@ -520,7 +523,7 @@ const lambdaProcessor = new firehose.LambdaFunctionProcessor(lambdaFunction, {
520
523
  });
521
524
  declare const bucket: s3.Bucket;
522
525
  const s3Destination = new firehose.S3Bucket(bucket, {
523
- processor: lambdaProcessor,
526
+ processors: [lambdaProcessor],
524
527
  });
525
528
  new firehose.DeliveryStream(this, 'Delivery Stream', {
526
529
  destination: s3Destination,
@@ -532,6 +535,60 @@ new firehose.DeliveryStream(this, 'Delivery Stream', {
532
535
  See: [Data Transformation](https://docs.aws.amazon.com/firehose/latest/dev/data-transformation.html)
533
536
  in the *Amazon Data Firehose Developer Guide*.
534
537
 
538
+ ### Add a new line delimiter when delivering data to Amazon S3
539
+
540
+ You can specify the `AppendDelimiterToRecordProcessor` built-in processor to add a new line delimiter between records in objects that are delivered to Amazon S3. This can be helpful for parsing objects in Amazon S3.
541
+ For details, see [Use Amazon S3 bucket prefix to deliver data](https://docs.aws.amazon.com/firehose/latest/dev/dynamic-partitioning-s3bucketprefix.html).
542
+
543
+ ```ts
544
+ declare const bucket: s3.Bucket;
545
+ const s3Destination = new firehose.S3Bucket(bucket, {
546
+ processors: [
547
+ new firehose.AppendDelimiterToRecordProcessor(),
548
+ ],
549
+ });
550
+ new firehose.DeliveryStream(this, 'Delivery Stream', {
551
+ destination: s3Destination,
552
+ });
553
+ ```
554
+
555
+ ### Decompress and extract message of CloudWatch Logs
556
+
557
+ CloudWatch Logs events are sent to Firehose in compressed gzip format. If you want to deliver decompressed log events to Firehose destinations, you can use the `DecompressionProcessor` to automatically decompress CloudWatch Logs.
558
+ For details, see [Send CloudWatch Logs to Firehose](https://docs.aws.amazon.com/firehose/latest/dev/writing-with-cloudwatch-logs.html).
559
+
560
+ You may also needed to specify `AppendDelimiterToRecordProcessor`
561
+ because decompressed log events record has no trailing newline.
562
+
563
+ ```ts
564
+ declare const bucket: s3.Bucket;
565
+ const s3Destination = new firehose.S3Bucket(bucket, {
566
+ processors: [
567
+ new firehose.DecompressionProcessor(),
568
+ new firehose.AppendDelimiterToRecordProcessor(),
569
+ ],
570
+ });
571
+ new firehose.DeliveryStream(this, 'Delivery Stream', {
572
+ destination: s3Destination,
573
+ });
574
+ ```
575
+
576
+ When you enable decompression, you have the option to also enable message extraction. When using message extraction, Firehose filters out all metadata, such as owner, loggroup, logstream, and others from the decompressed CloudWatch Logs records and delivers only the content inside the message fields.
577
+
578
+ ```ts
579
+ declare const bucket: s3.Bucket;
580
+ const s3Destination = new firehose.S3Bucket(bucket, {
581
+ processors: [
582
+ new firehose.DecompressionProcessor(),
583
+ new firehose.CloudWatchLogProcessor({ dataMessageExtraction: true }),
584
+ ],
585
+ });
586
+ new firehose.DeliveryStream(this, 'Delivery Stream', {
587
+ destination: s3Destination,
588
+ });
589
+ ```
590
+
591
+
535
592
  ## Specifying an IAM role
536
593
 
537
594
  The DeliveryStream class automatically creates IAM service roles with all the minimum
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ import * as path from 'path';
3
+ import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
4
+ import * as lambdanodejs from 'aws-cdk-lib/aws-lambda-nodejs';
5
+ import * as s3 from 'aws-cdk-lib/aws-s3';
6
+ import * as cdk from 'aws-cdk-lib';
7
+ import { IntegTest } from '@aws-cdk/integ-tests-alpha';
8
+
9
+ const app = new cdk.App();
10
+
11
+ const stack = new cdk.Stack(app, 'firehose-delivery-stream-cloudwatch-logs-processors');
12
+
13
+ const bucket = new s3.Bucket(stack, 'DestinationBucket', {
14
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
15
+ autoDeleteObjects: true,
16
+ });
17
+
18
+ const dataProcessorFunction = new lambdanodejs.NodejsFunction(stack, 'DataProcessorFunction', {
19
+ entry: path.join(__dirname, 'lambda-data-processor.js'),
20
+ timeout: cdk.Duration.minutes(1),
21
+ });
22
+
23
+ new firehose.DeliveryStream(stack, 'DecompressCloudWatchLogsEntry', {
24
+ destination: new firehose.S3Bucket(bucket, {
25
+ processors: [
26
+ new firehose.DecompressionProcessor(),
27
+ new firehose.AppendDelimiterToRecordProcessor(),
28
+ new firehose.LambdaFunctionProcessor(dataProcessorFunction),
29
+ ],
30
+ }),
31
+ });
32
+
33
+ new firehose.DeliveryStream(stack, 'ExtractCloudWatchLogsEntry', {
34
+ destination: new firehose.S3Bucket(bucket, {
35
+ processors: [
36
+ new firehose.DecompressionProcessor(),
37
+ new firehose.CloudWatchLogProcessor({ dataMessageExtraction: true }),
38
+ new firehose.LambdaFunctionProcessor(dataProcessorFunction),
39
+ ],
40
+ }),
41
+ });
42
+
43
+ new IntegTest(app, 'integ-tests', {
44
+ testCases: [stack],
45
+ });
@@ -10,20 +10,35 @@ const app = new App({
10
10
  });
11
11
  const stack = new Stack(app, 'aws-cdk-lambda-runtime-fromasset');
12
12
 
13
- const lambdaFunction = new Function(stack, 'MyFunction', {
13
+ const lambdaFunctionJava21 = new Function(stack, 'MyFunctionJava21', {
14
14
  runtime: Runtime.JAVA_21,
15
15
  handler: 'com.mycompany.app.LambdaMethodHandler::handleRequest',
16
16
  code: Code.fromAsset(path.join(__dirname, 'my-app-1.0-SNAPSHOT.zip')),
17
17
  });
18
18
 
19
+ const lambdaFunctionJava25 = new Function(stack, 'MyFunctionJava25', {
20
+ runtime: Runtime.JAVA_25,
21
+ handler: 'com.mycompany.app.LambdaMethodHandler::handleRequest',
22
+ code: Code.fromAsset(path.join(__dirname, 'my-app-1.0-SNAPSHOT.zip')),
23
+ });
24
+
19
25
  const integTest = new integ.IntegTest(app, 'Integ', { testCases: [stack] });
20
26
 
21
- const invoke = integTest.assertions.invokeFunction({
22
- functionName: lambdaFunction.functionName,
27
+ const invokeJava21 = integTest.assertions.invokeFunction({
28
+ functionName: lambdaFunctionJava21.functionName,
29
+ payload: '123',
30
+ });
31
+
32
+ invokeJava21.expect(integ.ExpectedResult.objectLike({
33
+ Payload: '"123"',
34
+ }));
35
+
36
+ const invokeJava25 = integTest.assertions.invokeFunction({
37
+ functionName: lambdaFunctionJava25.functionName,
23
38
  payload: '123',
24
39
  });
25
40
 
26
- invoke.expect(integ.ExpectedResult.objectLike({
41
+ invokeJava25.expect(integ.ExpectedResult.objectLike({
27
42
  Payload: '"123"',
28
43
  }));
29
44
 
@@ -55,6 +55,13 @@ const python313 = new Function(stack, 'PYTHON_3_13', {
55
55
  });
56
56
  new CfnOutput(stack, 'PYTHON_3_13-functionName', { value: python313.functionName });
57
57
 
58
+ const python314 = new Function(stack, 'PYTHON_3_14', {
59
+ code: new InlineCode('def handler(event, context):\n return "success"'),
60
+ handler: 'index.handler',
61
+ runtime: Runtime.PYTHON_3_14,
62
+ });
63
+ new CfnOutput(stack, 'PYTHON_3_14-functionName', { value: python314.functionName });
64
+
58
65
  const node20xfn = new Function(stack, 'NODEJS_20_X', {
59
66
  code: new InlineCode('exports.handler = async function(event) { return "success" }'),
60
67
  handler: 'index.handler',
@@ -1,6 +1,5 @@
1
1
  # AWS S3 Deployment Construct Library
2
2
 
3
-
4
3
  This library allows populating an S3 bucket with the contents of .zip files
5
4
  from other S3 buckets or from local disk.
6
5
 
@@ -83,7 +82,7 @@ User: *** is not authorized to perform: kms:Decrypt on the resource associated w
83
82
  because no identity-based policy allows the kms:Decrypt action
84
83
  ```
85
84
 
86
- When this happens, users can use the public `handlerRole` property of `BucketDeployment` to manually
85
+ When this happens, users can use the public `handlerRole` property of `BucketDeployment` to manually
87
86
  add the KMS permissions:
88
87
 
89
88
  ```ts
@@ -375,6 +374,7 @@ resource handler.
375
374
  > of memory and storage size.
376
375
 
377
376
  ## JSON-Aware Source Processing
377
+
378
378
  When using `Source.jsonData` with CDK Tokens (references to construct properties), you may need to enable the escaping option. This is particularly important when the referenced properties might contain special characters that require proper JSON escaping (like double quotes, line breaks, etc.).
379
379
 
380
380
  ```ts
@@ -462,7 +462,7 @@ to make from placeholders in a local file which will be resolved during deployme
462
462
  is especially useful in situations like creating an API from a spec file, where users might
463
463
  want to reference other CDK resources they have created.
464
464
 
465
- The syntax for template variables is `{{ variableName }}` in your local file. Then, you would
465
+ The syntax for template variables is `{{ variableName }}` in your local file. Then, you would
466
466
  specify the substitutions in CDK like this:
467
467
 
468
468
  ```ts
@@ -486,7 +486,7 @@ new s3deploy.DeployTimeSubstitutedFile(this, 'MyFile', {
486
486
  ```
487
487
 
488
488
  Nested variables, like `{{ {{ foo }} }}` or `{{ foo {{ bar }} }}`, are not supported by this
489
- construct. In the first case of a single variable being is double nested `{{ {{ foo }} }}`, only
489
+ construct. In the first case of a single variable being is double nested `{{ {{ foo }} }}`, only
490
490
  the `{{ foo }}` would be replaced by the substitution, and the extra brackets would remain in the file.
491
491
  In the second case of two nexted variables `{{ foo {{ bar }} }}`, only the `{{ bar }}` would be replaced
492
492
  in the file.
@@ -533,6 +533,67 @@ new cdk.CfnOutput(this, 'ObjectKey', {
533
533
  });
534
534
  ```
535
535
 
536
+ ## Specifying a Custom VPC, Subnets, and Security Groups in BucketDeployment
537
+
538
+ By default, the AWS CDK BucketDeployment construct runs in a publicly accessible environment. However, for enhanced security and compliance, you may need to deploy your assets from within a VPC while restricting network access through custom subnets and security groups.
539
+
540
+ ### Using a Custom VPC
541
+
542
+ To deploy assets within a private network, specify the vpc property in BucketDeploymentProps. This ensures that the deployment Lambda function executes within your specified VPC.
543
+
544
+ ```ts
545
+ const vpc = ec2.Vpc.fromLookup(this, 'ExistingVPC', { vpcId: 'vpc-12345678' });
546
+ const bucket = new s3.Bucket(this, 'MyBucket');
547
+
548
+ new s3deploy.BucketDeployment(this, 'DeployToS3', {
549
+ destinationBucket: bucket,
550
+ vpc: vpc,
551
+ sources: [s3deploy.Source.asset('./website')],
552
+ });
553
+ ```
554
+
555
+ ### Specifying Subnets for Deployment
556
+
557
+ By default, when you specify a VPC, the BucketDeployment function is deployed in the private subnets of that VPC.
558
+ However, you can customize the subnet selection using the vpcSubnets property.
559
+
560
+ ```ts
561
+ const vpc = ec2.Vpc.fromLookup(this, 'ExistingVPC', { vpcId: 'vpc-12345678' });
562
+ const bucket = new s3.Bucket(this, 'MyBucket');
563
+
564
+ new s3deploy.BucketDeployment(this, 'DeployToS3', {
565
+ destinationBucket: bucket,
566
+ vpc: vpc,
567
+ vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
568
+ sources: [s3deploy.Source.asset('./website')],
569
+ });
570
+ ```
571
+
572
+ ### Defining Custom Security Groups
573
+
574
+ For enhanced network security, you can now specify custom security groups in BucketDeploymentProps.
575
+ This allows fine-grained control over ingress and egress rules for the deployment Lambda function.
576
+
577
+ ```ts
578
+ const vpc = ec2.Vpc.fromLookup(this, 'ExistingVPC', { vpcId: 'vpc-12345678' });
579
+ const bucket = new s3.Bucket(this, 'MyBucket');
580
+
581
+ const securityGroup = new ec2.SecurityGroup(this, 'CustomSG', {
582
+ vpc: vpc,
583
+ description: 'Allow HTTPS outbound access',
584
+ allowAllOutbound: false,
585
+ });
586
+
587
+ securityGroup.addEgressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(443), 'Allow HTTPS traffic');
588
+
589
+ new s3deploy.BucketDeployment(this, 'DeployWithSecurityGroup', {
590
+ destinationBucket: bucket,
591
+ vpc: vpc,
592
+ securityGroups: [securityGroup],
593
+ sources: [s3deploy.Source.asset('./website')],
594
+ });
595
+ ```
596
+
536
597
  ## Notes
537
598
 
538
599
  - This library uses an AWS CloudFormation custom resource which is about 10MiB in
@@ -11,6 +11,12 @@ import { ExpectedResult } from '@aws-cdk/integ-tests-alpha';
11
11
 
12
12
  const numFiles = 50;
13
13
 
14
+ /**
15
+ * Integration test for bucket deployment with many sources (big response):
16
+ * - Tests deployment with 50 source files to validate response size handling
17
+ * - Uses increased memory limit (2048MB) for large deployments
18
+ * - Validates that objectKeys output is disabled when outputObjectKeys is false
19
+ */
14
20
  class TestBucketDeployment extends cdk.Stack {
15
21
  public readonly destinationBucket: s3.IBucket;
16
22
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
@@ -21,6 +27,7 @@ class TestBucketDeployment extends cdk.Stack {
21
27
  autoDeleteObjects: true, // needed for integration test cleanup
22
28
  });
23
29
 
30
+ // Create multiple source files to test big response handling
24
31
  const sources = [];
25
32
  for (let i = 0; i < numFiles; i++) {
26
33
  const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'tmpcdk'));
@@ -31,17 +38,17 @@ class TestBucketDeployment extends cdk.Stack {
31
38
  sources.push(s3deploy.Source.asset(tempDir));
32
39
  }
33
40
 
34
- const deploymentBucket = new s3deploy.BucketDeployment(this, 'DeployMe', {
41
+ const deployment = new s3deploy.BucketDeployment(this, 'DeployWithManySources', {
35
42
  sources: sources,
36
43
  destinationBucket: this.destinationBucket,
37
44
  memoryLimit: 2048,
38
- retainOnDelete: false, // default is true, which will block the integration test cleanup
45
+ retainOnDelete: false,
39
46
  outputObjectKeys: false,
40
47
  });
41
48
 
42
49
  new CfnOutput(this, 'customResourceData', {
43
50
  value: Fn.sub('Object Keys are${keys}', {
44
- keys: Fn.join(',', deploymentBucket.objectKeys),
51
+ keys: Fn.join(',', deployment.objectKeys),
45
52
  }),
46
53
  });
47
54
  }
@@ -54,12 +61,12 @@ const app = new cdk.App({
54
61
  });
55
62
  const testCase = new TestBucketDeployment(app, 'test-bucket-deployments-too-many-sources');
56
63
 
57
- const integTest = new integ.IntegTest(app, 'integ-test-bucket-deployments', {
64
+ const integTest = new integ.IntegTest(app, 'integ-test-bucket-deployment-big-response', {
58
65
  testCases: [testCase],
59
66
  diffAssets: true,
60
67
  });
61
68
 
62
- // Assert that DeployMeWithoutExtractingFilesOnDestination deploys a zip file to bucket4
69
+ // Assert that all files were successfully deployed
63
70
  for (let i = 0; i < numFiles; i++) {
64
71
  const apiCall = integTest.assertions.awsApiCall('S3', 'getObject', {
65
72
  Bucket: testCase.destinationBucket.bucketName,
@@ -73,7 +80,7 @@ for (let i = 0; i < numFiles; i++) {
73
80
  apiCall.assertAtPath('Body', ExpectedResult.stringLikeRegexp(`This is file number ${i + 1}`));
74
81
  }
75
82
 
76
- // Assert that there is no object keys returned from the custom resource
83
+ // Assert that objectKeys output is empty when outputObjectKeys is false
77
84
  const describe = integTest.assertions.awsApiCall('CloudFormation', 'describeStacks', {
78
85
  StackName: 'test-bucket-deployments-too-many-sources',
79
86
  });