@aws-solutions-constructs/aws-cloudfront-apigateway-lambda 2.47.0 → 2.49.0
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.
- package/.jsii +116 -36
- package/README.md +42 -18
- package/lib/index.d.ts +6 -3
- package/lib/index.js +17 -16
- package/package.json +7 -7
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.expected.json +370 -28
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.js +8 -1
- package/test/integ.cftaplam-no-arguments.expected.json +370 -28
- package/test/integ.cftaplam-no-arguments.js +8 -1
- package/test/integ.cftaplam-override-behavior.expected.json +370 -8
- package/test/integ.cftaplam-override-behavior.js +3 -2
- package/test/test.cloudfront-apigateway-lambda.test.js +46 -3
package/.jsii
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"url": "https://aws.amazon.com"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@aws-solutions-constructs/aws-cloudfront-apigateway": "2.
|
|
12
|
-
"@aws-solutions-constructs/core": "2.
|
|
13
|
-
"aws-cdk-lib": "^2.
|
|
11
|
+
"@aws-solutions-constructs/aws-cloudfront-apigateway": "2.49.0",
|
|
12
|
+
"@aws-solutions-constructs/core": "2.49.0",
|
|
13
|
+
"aws-cdk-lib": "^2.118.0",
|
|
14
14
|
"constructs": "^10.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencyClosure": {
|
|
@@ -272,6 +272,8 @@
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
},
|
|
275
|
+
"aws-cdk-lib.aws_apigatewayv2_authorizers": {},
|
|
276
|
+
"aws-cdk-lib.aws_apigatewayv2_integrations": {},
|
|
275
277
|
"aws-cdk-lib.aws_appconfig": {
|
|
276
278
|
"targets": {
|
|
277
279
|
"dotnet": {
|
|
@@ -402,6 +404,19 @@
|
|
|
402
404
|
}
|
|
403
405
|
}
|
|
404
406
|
},
|
|
407
|
+
"aws-cdk-lib.aws_arczonalshift": {
|
|
408
|
+
"targets": {
|
|
409
|
+
"dotnet": {
|
|
410
|
+
"package": "Amazon.CDK.AWS.ARCZonalShift"
|
|
411
|
+
},
|
|
412
|
+
"java": {
|
|
413
|
+
"package": "software.amazon.awscdk.services.arczonalshift"
|
|
414
|
+
},
|
|
415
|
+
"python": {
|
|
416
|
+
"module": "aws_cdk.aws_arczonalshift"
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
},
|
|
405
420
|
"aws-cdk-lib.aws_athena": {
|
|
406
421
|
"targets": {
|
|
407
422
|
"dotnet": {
|
|
@@ -480,6 +495,19 @@
|
|
|
480
495
|
}
|
|
481
496
|
}
|
|
482
497
|
},
|
|
498
|
+
"aws-cdk-lib.aws_b2bi": {
|
|
499
|
+
"targets": {
|
|
500
|
+
"dotnet": {
|
|
501
|
+
"package": "Amazon.CDK.AWS.B2BI"
|
|
502
|
+
},
|
|
503
|
+
"java": {
|
|
504
|
+
"package": "software.amazon.awscdk.services.b2bi"
|
|
505
|
+
},
|
|
506
|
+
"python": {
|
|
507
|
+
"module": "aws_cdk.aws_b2bi"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
},
|
|
483
511
|
"aws-cdk-lib.aws_backup": {
|
|
484
512
|
"targets": {
|
|
485
513
|
"dotnet": {
|
|
@@ -499,7 +527,7 @@
|
|
|
499
527
|
"package": "Amazon.CDK.AWS.BackupGateway"
|
|
500
528
|
},
|
|
501
529
|
"java": {
|
|
502
|
-
"package": "services.backupgateway"
|
|
530
|
+
"package": "software.amazon.awscdk.services.backupgateway"
|
|
503
531
|
},
|
|
504
532
|
"python": {
|
|
505
533
|
"module": "aws_cdk.aws_backupgateway"
|
|
@@ -519,6 +547,19 @@
|
|
|
519
547
|
}
|
|
520
548
|
}
|
|
521
549
|
},
|
|
550
|
+
"aws-cdk-lib.aws_bedrock": {
|
|
551
|
+
"targets": {
|
|
552
|
+
"dotnet": {
|
|
553
|
+
"namespace": "Amazon.CDK.AWS.Bedrock"
|
|
554
|
+
},
|
|
555
|
+
"java": {
|
|
556
|
+
"package": "software.amazon.awscdk.services.bedrock"
|
|
557
|
+
},
|
|
558
|
+
"python": {
|
|
559
|
+
"module": "aws_cdk.aws_bedrock"
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
},
|
|
522
563
|
"aws-cdk-lib.aws_billingconductor": {
|
|
523
564
|
"targets": {
|
|
524
565
|
"dotnet": {
|
|
@@ -603,7 +644,7 @@
|
|
|
603
644
|
"package": "Amazon.CDK.AWS.CleanRooms"
|
|
604
645
|
},
|
|
605
646
|
"java": {
|
|
606
|
-
"package": "services.cleanrooms"
|
|
647
|
+
"package": "software.amazon.awscdk.services.cleanrooms"
|
|
607
648
|
},
|
|
608
649
|
"python": {
|
|
609
650
|
"module": "aws_cdk.aws_cleanrooms"
|
|
@@ -1345,7 +1386,7 @@
|
|
|
1345
1386
|
"package": "Amazon.CDK.AWS.EntityResolution"
|
|
1346
1387
|
},
|
|
1347
1388
|
"java": {
|
|
1348
|
-
"package": "services.entityresolution"
|
|
1389
|
+
"package": "software.amazon.awscdk.services.entityresolution"
|
|
1349
1390
|
},
|
|
1350
1391
|
"python": {
|
|
1351
1392
|
"module": "aws_cdk.aws_entityresolution"
|
|
@@ -1605,7 +1646,7 @@
|
|
|
1605
1646
|
"package": "Amazon.CDK.AWS.HealthImaging"
|
|
1606
1647
|
},
|
|
1607
1648
|
"java": {
|
|
1608
|
-
"package": "services.healthimaging"
|
|
1649
|
+
"package": "software.amazon.awscdk.services.healthimaging"
|
|
1609
1650
|
},
|
|
1610
1651
|
"python": {
|
|
1611
1652
|
"module": "aws_cdk.aws_healthimaging"
|
|
@@ -2268,7 +2309,7 @@
|
|
|
2268
2309
|
"package": "Amazon.CDK.AWS.MediaPackageV2"
|
|
2269
2310
|
},
|
|
2270
2311
|
"java": {
|
|
2271
|
-
"package": "services.mediapackagev2"
|
|
2312
|
+
"package": "software.amazon.awscdk.services.mediapackagev2"
|
|
2272
2313
|
},
|
|
2273
2314
|
"python": {
|
|
2274
2315
|
"module": "aws_cdk.aws_mediapackagev2"
|
|
@@ -2353,6 +2394,19 @@
|
|
|
2353
2394
|
}
|
|
2354
2395
|
}
|
|
2355
2396
|
},
|
|
2397
|
+
"aws-cdk-lib.aws_neptunegraph": {
|
|
2398
|
+
"targets": {
|
|
2399
|
+
"dotnet": {
|
|
2400
|
+
"package": "Amazon.CDK.AWS.NeptuneGraph"
|
|
2401
|
+
},
|
|
2402
|
+
"java": {
|
|
2403
|
+
"package": "software.amazon.awscdk.services.neptunegraph"
|
|
2404
|
+
},
|
|
2405
|
+
"python": {
|
|
2406
|
+
"module": "aws_cdk.aws_neptunegraph"
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
},
|
|
2356
2410
|
"aws-cdk-lib.aws_networkfirewall": {
|
|
2357
2411
|
"targets": {
|
|
2358
2412
|
"dotnet": {
|
|
@@ -2489,7 +2543,7 @@
|
|
|
2489
2543
|
"package": "Amazon.CDK.AWS.OSIS"
|
|
2490
2544
|
},
|
|
2491
2545
|
"java": {
|
|
2492
|
-
"package": "services.osis"
|
|
2546
|
+
"package": "software.amazon.awscdk.services.osis"
|
|
2493
2547
|
},
|
|
2494
2548
|
"python": {
|
|
2495
2549
|
"module": "aws_cdk.aws_osis"
|
|
@@ -2515,7 +2569,7 @@
|
|
|
2515
2569
|
"package": "Amazon.CDK.AWS.PCAConnectorAD"
|
|
2516
2570
|
},
|
|
2517
2571
|
"java": {
|
|
2518
|
-
"package": "services.pcaconnectorad"
|
|
2572
|
+
"package": "software.amazon.awscdk.services.pcaconnectorad"
|
|
2519
2573
|
},
|
|
2520
2574
|
"python": {
|
|
2521
2575
|
"module": "aws_cdk.aws_pcaconnectorad"
|
|
@@ -2580,7 +2634,7 @@
|
|
|
2580
2634
|
"package": "Amazon.CDK.AWS.Proton"
|
|
2581
2635
|
},
|
|
2582
2636
|
"java": {
|
|
2583
|
-
"package": "services.proton"
|
|
2637
|
+
"package": "software.amazon.awscdk.services.proton"
|
|
2584
2638
|
},
|
|
2585
2639
|
"python": {
|
|
2586
2640
|
"module": "aws_cdk.aws_proton"
|
|
@@ -2899,6 +2953,19 @@
|
|
|
2899
2953
|
}
|
|
2900
2954
|
}
|
|
2901
2955
|
},
|
|
2956
|
+
"aws-cdk-lib.aws_s3express": {
|
|
2957
|
+
"targets": {
|
|
2958
|
+
"dotnet": {
|
|
2959
|
+
"package": "Amazon.CDK.AWS.S3Express"
|
|
2960
|
+
},
|
|
2961
|
+
"java": {
|
|
2962
|
+
"package": "software.amazon.awscdk.services.s3express"
|
|
2963
|
+
},
|
|
2964
|
+
"python": {
|
|
2965
|
+
"module": "aws_cdk.aws_s3express"
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
},
|
|
2902
2969
|
"aws-cdk-lib.aws_s3objectlambda": {
|
|
2903
2970
|
"targets": {
|
|
2904
2971
|
"dotnet": {
|
|
@@ -3074,7 +3141,7 @@
|
|
|
3074
3141
|
"package": "Amazon.CDK.AWS.Shield"
|
|
3075
3142
|
},
|
|
3076
3143
|
"java": {
|
|
3077
|
-
"package": "services.shield"
|
|
3144
|
+
"package": "software.amazon.awscdk.services.shield"
|
|
3078
3145
|
},
|
|
3079
3146
|
"python": {
|
|
3080
3147
|
"module": "aws_cdk.aws_shield"
|
|
@@ -3295,7 +3362,7 @@
|
|
|
3295
3362
|
"package": "Amazon.CDK.AWS.VerifiedPermissions"
|
|
3296
3363
|
},
|
|
3297
3364
|
"java": {
|
|
3298
|
-
"package": "services.verifiedpermissions"
|
|
3365
|
+
"package": "software.amazon.awscdk.services.verifiedpermissions"
|
|
3299
3366
|
},
|
|
3300
3367
|
"python": {
|
|
3301
3368
|
"module": "aws_cdk.aws_verifiedpermissions"
|
|
@@ -3393,13 +3460,26 @@
|
|
|
3393
3460
|
}
|
|
3394
3461
|
}
|
|
3395
3462
|
},
|
|
3463
|
+
"aws-cdk-lib.aws_workspacesthinclient": {
|
|
3464
|
+
"targets": {
|
|
3465
|
+
"dotnet": {
|
|
3466
|
+
"package": "Amazon.CDK.AWS.WorkSpacesThinClient"
|
|
3467
|
+
},
|
|
3468
|
+
"java": {
|
|
3469
|
+
"package": "software.amazon.awscdk.services.workspacesthinclient"
|
|
3470
|
+
},
|
|
3471
|
+
"python": {
|
|
3472
|
+
"module": "aws_cdk.aws_workspacesthinclient"
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
},
|
|
3396
3476
|
"aws-cdk-lib.aws_workspacesweb": {
|
|
3397
3477
|
"targets": {
|
|
3398
3478
|
"dotnet": {
|
|
3399
3479
|
"package": "Amazon.CDK.AWS.WorkSpacesWeb"
|
|
3400
3480
|
},
|
|
3401
3481
|
"java": {
|
|
3402
|
-
"package": "services.workspacesweb"
|
|
3482
|
+
"package": "software.amazon.awscdk.services.workspacesweb"
|
|
3403
3483
|
},
|
|
3404
3484
|
"python": {
|
|
3405
3485
|
"module": "aws_cdk.aws_workspacesweb"
|
|
@@ -3604,7 +3684,7 @@
|
|
|
3604
3684
|
},
|
|
3605
3685
|
"description": "CDK Constructs for AWS Cloudfront to AWS API Gateway to AWS Lambda integration.",
|
|
3606
3686
|
"homepage": "https://github.com/awslabs/aws-solutions-constructs.git",
|
|
3607
|
-
"jsiiVersion": "1.
|
|
3687
|
+
"jsiiVersion": "1.94.0 (build b380f01)",
|
|
3608
3688
|
"keywords": [
|
|
3609
3689
|
"aws",
|
|
3610
3690
|
"cdk",
|
|
@@ -3624,7 +3704,7 @@
|
|
|
3624
3704
|
},
|
|
3625
3705
|
"name": "@aws-solutions-constructs/aws-cloudfront-apigateway-lambda",
|
|
3626
3706
|
"readme": {
|
|
3627
|
-
"markdown": "# aws-cloudfront-apigateway-lambda module\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n---\n<!--END STABILITY BANNER-->\n\n| **Reference Documentation**:| <span style=\"font-weight: normal\">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|\n|:-------------|:-------------|\n<div style=\"height:8px\"></div>\n\n| **Language** | **Package** |\n|:-------------|-----------------|\n| Python|`aws_solutions_constructs.aws_cloudfront_apigateway_lambda`|\n| Typescript|`@aws-solutions-constructs/aws-cloudfront-apigateway-lambda`|\n| Java|`software.amazon.awsconstructs.services.cloudfrontapigatewaylambda`|\n\n## Overview\nThis AWS Solutions Construct implements an AWS CloudFront fronting an Amazon API Gateway Lambda backed REST API.\n\nHere is a minimal deployable pattern definition:\n\nTypescript\n``` typescript\nimport { Construct } from 'constructs';\nimport { Stack, StackProps } from 'aws-cdk-lib';\nimport { CloudFrontToApiGatewayToLambda } from '@aws-solutions-constructs/aws-cloudfront-apigateway-lambda';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\nnew CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', {\n lambdaFunctionProps: {\n code: lambda.Code.fromAsset(`lambda`),\n runtime: lambda.Runtime.NODEJS_16_X,\n handler: 'index.handler'\n }\n});\n```\n\nPython\n``` python\nfrom aws_solutions_constructs.aws_cloudfront_apigateway_lambda import CloudFrontToApiGatewayToLambda\nfrom aws_cdk import (\n aws_lambda as _lambda,\n Stack\n)\nfrom constructs import Construct\n\
|
|
3707
|
+
"markdown": "# aws-cloudfront-apigateway-lambda module\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n---\n<!--END STABILITY BANNER-->\n\n| **Reference Documentation**:| <span style=\"font-weight: normal\">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|\n|:-------------|:-------------|\n<div style=\"height:8px\"></div>\n\n| **Language** | **Package** |\n|:-------------|-----------------|\n| Python|`aws_solutions_constructs.aws_cloudfront_apigateway_lambda`|\n| Typescript|`@aws-solutions-constructs/aws-cloudfront-apigateway-lambda`|\n| Java|`software.amazon.awsconstructs.services.cloudfrontapigatewaylambda`|\n\n## Overview\nThis AWS Solutions Construct implements an AWS CloudFront fronting an Amazon API Gateway Lambda backed REST API.\n\nHere is a minimal deployable pattern definition:\n\nTypescript\n``` typescript\nimport { Construct } from 'constructs';\nimport { Stack, StackProps } from 'aws-cdk-lib';\nimport { CloudFrontToApiGatewayToLambda } from '@aws-solutions-constructs/aws-cloudfront-apigateway-lambda';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\nnew CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', {\n lambdaFunctionProps: {\n code: lambda.Code.fromAsset(`lambda`),\n runtime: lambda.Runtime.NODEJS_16_X,\n handler: 'index.handler'\n },\n apiGatewayProps: {\n defaultMethodOptions: {\n authorizationType: api.AuthorizationType.NONE\n }\n },\n});\n```\n\nPython\n``` python\nfrom aws_solutions_constructs.aws_cloudfront_apigateway_lambda import CloudFrontToApiGatewayToLambda\nfrom aws_cdk import (\n aws_lambda as _lambda,\n aws_apigateway as apigw,\n Stack\n)\nfrom constructs import Construct\n\n CloudFrontToApiGatewayToLambda(\n self, 'CloudFrontApiGatewayToLambda',\n lambda_function_props=_lambda.FunctionProps(\n runtime=_lambda.Runtime.PYTHON_3_7,\n code=_lambda.Code.from_asset('lambda'),\n handler='hello.handler',\n ),\n # NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires\n # the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps\n # (although does not *extend* that interface) this works fine when the props object reaches the\n # underlying TypeScript code that implements Constructs\n api_gateway_props=apigw.RestApiProps(\n default_method_options=apigw.MethodOptions(\n authorization_type=apigw.AuthorizationType.NONE\n )\n )\n )\n```\n\nJava\n``` java\nimport software.constructs.Construct;\n\nimport software.amazon.awscdk.Stack;\nimport software.amazon.awscdk.StackProps;\nimport software.amazon.awscdk.services.lambda.*;\nimport software.amazon.awscdk.services.lambda.Runtime;\nimport software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.*;\nimport software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.CloudFrontToApiGatewayToLambdaProps;\n\nnew CloudFrontToApiGatewayToLambda(this, \"ApiGatewayToLambdaPattern\", new CloudFrontToApiGatewayToLambdaProps.Builder()\n .lambdaFunctionProps(new FunctionProps.Builder()\n .runtime(Runtime.NODEJS_16_X) // execution environment\n .code(Code.fromAsset(\"lambda\")) // code loaded from the `lambda` directory (under root, next to `src`)\n .handler(\"hello.handler\") // file is `hello`, function is `handler`\n .build())\n // NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires\n // the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps\n // (although does not *extend* that interface) this works fine when the props object reaches the\n // underlying TypeScript code that implements Constructs\n .apiGatewayProps(new RestApiProps.Builder()\n .defaultMethodOptions(new MethodOptions.Builder()\n .authorizationType(AuthorizationType.NONE)\n .build())\n .build())\n .build());\n```\n\n## Pattern Construct Props\n\n| **Name** | **Type** | **Description** |\n|:-------------|:----------------|-----------------|\n|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|\n|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|Optional user provided props to override the default props for the Lambda function.|\n|apiGatewayProps?|[`api.LambdaRestApiProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.LambdaRestApiProps.html)|User provided props to override the default props for the API Gateway. As of release 2.48.0, clients must include this property with `defaultMethodOptions: { authorizationType: string }` specified. See Issue1043 in the github repo https://github.com/awslabs/aws-solutions-constructs/issues/1043 |\n|cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|\n|insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|\n| responseHeadersPolicyProps? | [`cloudfront.ResponseHeadersPolicyProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicyProps.html) | Optional user provided configuration that cloudfront applies to all http responses. |\n|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroupProps.html)|Optional user provided props to override the default props for for the CloudWatchLogs LogGroup.|\n|cloudFrontLoggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Logging Bucket.|\n\n## Pattern Properties\n\n| **Name** | **Type** | **Description** |\n|:-------------|:----------------|-----------------|\n|cloudFrontWebDistribution|[`cloudfront.Distribution`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Distribution.html)|Returns an instance of cloudfront.Distribution created by the construct|\n|cloudFrontFunction?|[`cloudfront.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Function.html)|Returns an instance of the Cloudfront function created by the pattern.|\n|cloudFrontLoggingBucket|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-readme.html)|Returns an instance of the logging bucket for CloudFront Distribution.|\n|apiGateway|[`api.RestApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApi.html)|Returns an instance of the API Gateway REST API created by the pattern.|\n|apiGatewayCloudWatchRole?|[`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html)|Returns an instance of the iam.Role created by the construct for API Gateway for CloudWatch access.|\n|apiGatewayLogGroup|[`logs.LogGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html)|Returns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch.|\n|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Returns an instance of the Lambda function created by the pattern.|\n\n## Default settings\n\nOut of the box implementation of the Construct without any override will set the following defaults:\n\n### Amazon CloudFront\n* Configure Access logging for CloudFront Distribution\n* Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution\n\n### Amazon API Gateway\n* Deploy a regional API endpoint\n* Enable CloudWatch logging for API Gateway\n* Configure least privilege access IAM role for API Gateway\n* Set the default authorizationType for all API methods to NONE\n* Enable X-Ray Tracing\n\n### AWS Lambda Function\n* Configure limited privilege access IAM role for Lambda function\n* Enable reusing connections with Keep-Alive for NodeJs Lambda function\n* Enable X-Ray Tracing\n* Set Environment Variables\n * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)\n\n## Architecture\n\n\n***\n© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n"
|
|
3628
3708
|
},
|
|
3629
3709
|
"repository": {
|
|
3630
3710
|
"directory": "source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda",
|
|
@@ -3669,7 +3749,7 @@
|
|
|
3669
3749
|
},
|
|
3670
3750
|
"locationInModule": {
|
|
3671
3751
|
"filename": "lib/index.ts",
|
|
3672
|
-
"line":
|
|
3752
|
+
"line": 108
|
|
3673
3753
|
},
|
|
3674
3754
|
"parameters": [
|
|
3675
3755
|
{
|
|
@@ -3704,7 +3784,7 @@
|
|
|
3704
3784
|
"kind": "class",
|
|
3705
3785
|
"locationInModule": {
|
|
3706
3786
|
"filename": "lib/index.ts",
|
|
3707
|
-
"line":
|
|
3787
|
+
"line": 91
|
|
3708
3788
|
},
|
|
3709
3789
|
"name": "CloudFrontToApiGatewayToLambda",
|
|
3710
3790
|
"properties": [
|
|
@@ -3712,7 +3792,7 @@
|
|
|
3712
3792
|
"immutable": true,
|
|
3713
3793
|
"locationInModule": {
|
|
3714
3794
|
"filename": "lib/index.ts",
|
|
3715
|
-
"line":
|
|
3795
|
+
"line": 95
|
|
3716
3796
|
},
|
|
3717
3797
|
"name": "apiGateway",
|
|
3718
3798
|
"type": {
|
|
@@ -3723,7 +3803,7 @@
|
|
|
3723
3803
|
"immutable": true,
|
|
3724
3804
|
"locationInModule": {
|
|
3725
3805
|
"filename": "lib/index.ts",
|
|
3726
|
-
"line":
|
|
3806
|
+
"line": 97
|
|
3727
3807
|
},
|
|
3728
3808
|
"name": "apiGatewayLogGroup",
|
|
3729
3809
|
"type": {
|
|
@@ -3734,7 +3814,7 @@
|
|
|
3734
3814
|
"immutable": true,
|
|
3735
3815
|
"locationInModule": {
|
|
3736
3816
|
"filename": "lib/index.ts",
|
|
3737
|
-
"line":
|
|
3817
|
+
"line": 92
|
|
3738
3818
|
},
|
|
3739
3819
|
"name": "cloudFrontWebDistribution",
|
|
3740
3820
|
"type": {
|
|
@@ -3745,7 +3825,7 @@
|
|
|
3745
3825
|
"immutable": true,
|
|
3746
3826
|
"locationInModule": {
|
|
3747
3827
|
"filename": "lib/index.ts",
|
|
3748
|
-
"line":
|
|
3828
|
+
"line": 98
|
|
3749
3829
|
},
|
|
3750
3830
|
"name": "lambdaFunction",
|
|
3751
3831
|
"type": {
|
|
@@ -3756,7 +3836,7 @@
|
|
|
3756
3836
|
"immutable": true,
|
|
3757
3837
|
"locationInModule": {
|
|
3758
3838
|
"filename": "lib/index.ts",
|
|
3759
|
-
"line":
|
|
3839
|
+
"line": 96
|
|
3760
3840
|
},
|
|
3761
3841
|
"name": "apiGatewayCloudWatchRole",
|
|
3762
3842
|
"optional": true,
|
|
@@ -3768,7 +3848,7 @@
|
|
|
3768
3848
|
"immutable": true,
|
|
3769
3849
|
"locationInModule": {
|
|
3770
3850
|
"filename": "lib/index.ts",
|
|
3771
|
-
"line":
|
|
3851
|
+
"line": 93
|
|
3772
3852
|
},
|
|
3773
3853
|
"name": "cloudFrontFunction",
|
|
3774
3854
|
"optional": true,
|
|
@@ -3780,7 +3860,7 @@
|
|
|
3780
3860
|
"immutable": true,
|
|
3781
3861
|
"locationInModule": {
|
|
3782
3862
|
"filename": "lib/index.ts",
|
|
3783
|
-
"line":
|
|
3863
|
+
"line": 94
|
|
3784
3864
|
},
|
|
3785
3865
|
"name": "cloudFrontLoggingBucket",
|
|
3786
3866
|
"optional": true,
|
|
@@ -3810,16 +3890,16 @@
|
|
|
3810
3890
|
{
|
|
3811
3891
|
"abstract": true,
|
|
3812
3892
|
"docs": {
|
|
3813
|
-
"default": "-
|
|
3814
|
-
"
|
|
3893
|
+
"default": "- defaultMethodOptions/authorizationType is required, for other, unspecified values the\ndefault props are used",
|
|
3894
|
+
"remarks": "As of release\n2.48.0, clients must include this property with defaultMethodOptions: { authorizationType: string } specified.\nSee Issue1043 in the github repo https://github.com/awslabs/aws-solutions-constructs/issues/1043",
|
|
3895
|
+
"summary": "User provided props to override the default props for the API Gateway."
|
|
3815
3896
|
},
|
|
3816
3897
|
"immutable": true,
|
|
3817
3898
|
"locationInModule": {
|
|
3818
3899
|
"filename": "lib/index.ts",
|
|
3819
|
-
"line":
|
|
3900
|
+
"line": 49
|
|
3820
3901
|
},
|
|
3821
3902
|
"name": "apiGatewayProps",
|
|
3822
|
-
"optional": true,
|
|
3823
3903
|
"type": {
|
|
3824
3904
|
"primitive": "any"
|
|
3825
3905
|
}
|
|
@@ -3833,7 +3913,7 @@
|
|
|
3833
3913
|
"immutable": true,
|
|
3834
3914
|
"locationInModule": {
|
|
3835
3915
|
"filename": "lib/index.ts",
|
|
3836
|
-
"line":
|
|
3916
|
+
"line": 55
|
|
3837
3917
|
},
|
|
3838
3918
|
"name": "cloudFrontDistributionProps",
|
|
3839
3919
|
"optional": true,
|
|
@@ -3850,7 +3930,7 @@
|
|
|
3850
3930
|
"immutable": true,
|
|
3851
3931
|
"locationInModule": {
|
|
3852
3932
|
"filename": "lib/index.ts",
|
|
3853
|
-
"line":
|
|
3933
|
+
"line": 88
|
|
3854
3934
|
},
|
|
3855
3935
|
"name": "cloudFrontLoggingBucketProps",
|
|
3856
3936
|
"optional": true,
|
|
@@ -3885,7 +3965,7 @@
|
|
|
3885
3965
|
"immutable": true,
|
|
3886
3966
|
"locationInModule": {
|
|
3887
3967
|
"filename": "lib/index.ts",
|
|
3888
|
-
"line":
|
|
3968
|
+
"line": 64
|
|
3889
3969
|
},
|
|
3890
3970
|
"name": "insertHttpSecurityHeaders",
|
|
3891
3971
|
"optional": true,
|
|
@@ -3919,7 +3999,7 @@
|
|
|
3919
3999
|
"immutable": true,
|
|
3920
4000
|
"locationInModule": {
|
|
3921
4001
|
"filename": "lib/index.ts",
|
|
3922
|
-
"line":
|
|
4002
|
+
"line": 82
|
|
3923
4003
|
},
|
|
3924
4004
|
"name": "logGroupProps",
|
|
3925
4005
|
"optional": true,
|
|
@@ -3937,7 +4017,7 @@
|
|
|
3937
4017
|
"immutable": true,
|
|
3938
4018
|
"locationInModule": {
|
|
3939
4019
|
"filename": "lib/index.ts",
|
|
3940
|
-
"line":
|
|
4020
|
+
"line": 76
|
|
3941
4021
|
},
|
|
3942
4022
|
"name": "responseHeadersPolicyProps",
|
|
3943
4023
|
"optional": true,
|
|
@@ -3949,6 +4029,6 @@
|
|
|
3949
4029
|
"symbolId": "lib/index:CloudFrontToApiGatewayToLambdaProps"
|
|
3950
4030
|
}
|
|
3951
4031
|
},
|
|
3952
|
-
"version": "2.
|
|
3953
|
-
"fingerprint": "
|
|
4032
|
+
"version": "2.49.0",
|
|
4033
|
+
"fingerprint": "IuiHGhC0okBnpU9sOIeIt/a9R4iCT+zHqdkZQYqf1+A="
|
|
3954
4034
|
}
|
package/README.md
CHANGED
|
@@ -35,7 +35,12 @@ new CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', {
|
|
|
35
35
|
code: lambda.Code.fromAsset(`lambda`),
|
|
36
36
|
runtime: lambda.Runtime.NODEJS_16_X,
|
|
37
37
|
handler: 'index.handler'
|
|
38
|
-
}
|
|
38
|
+
},
|
|
39
|
+
apiGatewayProps: {
|
|
40
|
+
defaultMethodOptions: {
|
|
41
|
+
authorizationType: api.AuthorizationType.NONE
|
|
42
|
+
}
|
|
43
|
+
},
|
|
39
44
|
});
|
|
40
45
|
```
|
|
41
46
|
|
|
@@ -44,17 +49,28 @@ Python
|
|
|
44
49
|
from aws_solutions_constructs.aws_cloudfront_apigateway_lambda import CloudFrontToApiGatewayToLambda
|
|
45
50
|
from aws_cdk import (
|
|
46
51
|
aws_lambda as _lambda,
|
|
52
|
+
aws_apigateway as apigw,
|
|
47
53
|
Stack
|
|
48
54
|
)
|
|
49
55
|
from constructs import Construct
|
|
50
56
|
|
|
51
|
-
CloudFrontToApiGatewayToLambda(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
CloudFrontToApiGatewayToLambda(
|
|
58
|
+
self, 'CloudFrontApiGatewayToLambda',
|
|
59
|
+
lambda_function_props=_lambda.FunctionProps(
|
|
60
|
+
runtime=_lambda.Runtime.PYTHON_3_7,
|
|
61
|
+
code=_lambda.Code.from_asset('lambda'),
|
|
62
|
+
handler='hello.handler',
|
|
63
|
+
),
|
|
64
|
+
# NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
|
|
65
|
+
# the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
|
|
66
|
+
# (although does not *extend* that interface) this works fine when the props object reaches the
|
|
67
|
+
# underlying TypeScript code that implements Constructs
|
|
68
|
+
api_gateway_props=apigw.RestApiProps(
|
|
69
|
+
default_method_options=apigw.MethodOptions(
|
|
70
|
+
authorization_type=apigw.AuthorizationType.NONE
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
)
|
|
58
74
|
```
|
|
59
75
|
|
|
60
76
|
Java
|
|
@@ -66,25 +82,33 @@ import software.amazon.awscdk.StackProps;
|
|
|
66
82
|
import software.amazon.awscdk.services.lambda.*;
|
|
67
83
|
import software.amazon.awscdk.services.lambda.Runtime;
|
|
68
84
|
import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.*;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.CloudFrontToApiGatewayToLambdaProps;
|
|
86
|
+
|
|
87
|
+
new CloudFrontToApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new CloudFrontToApiGatewayToLambdaProps.Builder()
|
|
88
|
+
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
89
|
+
.runtime(Runtime.NODEJS_16_X) // execution environment
|
|
90
|
+
.code(Code.fromAsset("lambda")) // code loaded from the `lambda` directory (under root, next to `src`)
|
|
91
|
+
.handler("hello.handler") // file is `hello`, function is `handler`
|
|
92
|
+
.build())
|
|
93
|
+
// NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
|
|
94
|
+
// the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
|
|
95
|
+
// (although does not *extend* that interface) this works fine when the props object reaches the
|
|
96
|
+
// underlying TypeScript code that implements Constructs
|
|
97
|
+
.apiGatewayProps(new RestApiProps.Builder()
|
|
98
|
+
.defaultMethodOptions(new MethodOptions.Builder()
|
|
99
|
+
.authorizationType(AuthorizationType.NONE)
|
|
76
100
|
.build())
|
|
77
|
-
.build())
|
|
101
|
+
.build())
|
|
102
|
+
.build());
|
|
78
103
|
```
|
|
79
104
|
|
|
80
|
-
|
|
81
105
|
## Pattern Construct Props
|
|
82
106
|
|
|
83
107
|
| **Name** | **Type** | **Description** |
|
|
84
108
|
|:-------------|:----------------|-----------------|
|
|
85
109
|
|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|
|
|
86
110
|
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|Optional user provided props to override the default props for the Lambda function.|
|
|
87
|
-
|apiGatewayProps?|[`api.LambdaRestApiProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.LambdaRestApiProps.html)|
|
|
111
|
+
|apiGatewayProps?|[`api.LambdaRestApiProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.LambdaRestApiProps.html)|User provided props to override the default props for the API Gateway. As of release 2.48.0, clients must include this property with `defaultMethodOptions: { authorizationType: string }` specified. See Issue1043 in the github repo https://github.com/awslabs/aws-solutions-constructs/issues/1043 |
|
|
88
112
|
|cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
|
|
89
113
|
|insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
|
|
90
114
|
| responseHeadersPolicyProps? | [`cloudfront.ResponseHeadersPolicyProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicyProps.html) | Optional user provided configuration that cloudfront applies to all http responses. |
|
package/lib/index.d.ts
CHANGED
|
@@ -34,11 +34,14 @@ export interface CloudFrontToApiGatewayToLambdaProps {
|
|
|
34
34
|
*/
|
|
35
35
|
readonly lambdaFunctionProps?: lambda.FunctionProps;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* User provided props to override the default props for the API Gateway. As of release
|
|
38
|
+
* 2.48.0, clients must include this property with defaultMethodOptions: { authorizationType: string } specified.
|
|
39
|
+
* See Issue1043 in the github repo https://github.com/awslabs/aws-solutions-constructs/issues/1043
|
|
38
40
|
*
|
|
39
|
-
* @default -
|
|
41
|
+
* @default - defaultMethodOptions/authorizationType is required, for other, unspecified values the
|
|
42
|
+
* default props are used
|
|
40
43
|
*/
|
|
41
|
-
readonly apiGatewayProps
|
|
44
|
+
readonly apiGatewayProps: api.LambdaRestApiProps | any;
|
|
42
45
|
/**
|
|
43
46
|
* Optional user provided props to override the default props
|
|
44
47
|
*
|