aws-solutions-constructs.aws-cloudfront-apigateway-lambda 2.85.2__tar.gz → 2.85.3__tar.gz

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.
Files changed (20) hide show
  1. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3/PKG-INFO +29 -0
  2. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3/README.md +1 -0
  3. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/setup.py +4 -4
  4. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/__init__.py +1 -168
  5. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/_jsii/__init__.py +2 -2
  6. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3/src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/_jsii/aws-cloudfront-apigateway-lambda@2.85.3.jsii.tgz +0 -0
  7. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3/src/aws_solutions_constructs.aws_cloudfront_apigateway_lambda.egg-info/PKG-INFO +29 -0
  8. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/src/aws_solutions_constructs.aws_cloudfront_apigateway_lambda.egg-info/SOURCES.txt +1 -1
  9. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/src/aws_solutions_constructs.aws_cloudfront_apigateway_lambda.egg-info/requires.txt +2 -2
  10. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2/PKG-INFO +0 -196
  11. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2/README.md +0 -168
  12. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2/src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/_jsii/aws-cloudfront-apigateway-lambda@2.85.2.jsii.tgz +0 -0
  13. aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2/src/aws_solutions_constructs.aws_cloudfront_apigateway_lambda.egg-info/PKG-INFO +0 -196
  14. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/LICENSE +0 -0
  15. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/MANIFEST.in +0 -0
  16. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/pyproject.toml +0 -0
  17. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/setup.cfg +0 -0
  18. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/py.typed +0 -0
  19. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/src/aws_solutions_constructs.aws_cloudfront_apigateway_lambda.egg-info/dependency_links.txt +0 -0
  20. {aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.2 → aws_solutions_constructs_aws_cloudfront_apigateway_lambda-2.85.3}/src/aws_solutions_constructs.aws_cloudfront_apigateway_lambda.egg-info/top_level.txt +0 -0
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-cloudfront-apigateway-lambda
3
+ Version: 2.85.3
4
+ Summary: CDK Constructs for AWS Cloudfront to AWS API Gateway to AWS Lambda integration.
5
+ Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
+ Author: Amazon Web Services
7
+ License: Apache-2.0
8
+ Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: JavaScript
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Typing :: Typed
17
+ Classifier: License :: OSI Approved
18
+ Requires-Python: ~=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
+ Requires-Dist: aws-solutions-constructs.aws-cloudfront-apigateway==2.85.3
23
+ Requires-Dist: aws-solutions-constructs.core==2.85.3
24
+ Requires-Dist: constructs<11.0.0,>=10.0.0
25
+ Requires-Dist: jsii<2.0.0,>=1.111.0
26
+ Requires-Dist: publication>=0.0.3
27
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
28
+
29
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.adoc)
@@ -0,0 +1 @@
1
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.adoc)
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "aws-solutions-constructs.aws-cloudfront-apigateway-lambda",
8
- "version": "2.85.2",
8
+ "version": "2.85.3",
9
9
  "description": "CDK Constructs for AWS Cloudfront to AWS API Gateway to AWS Lambda integration.",
10
10
  "license": "Apache-2.0",
11
11
  "url": "https://github.com/awslabs/aws-solutions-constructs.git",
@@ -26,7 +26,7 @@ kwargs = json.loads(
26
26
  ],
27
27
  "package_data": {
28
28
  "aws_solutions_constructs.aws_cloudfront_apigateway_lambda._jsii": [
29
- "aws-cloudfront-apigateway-lambda@2.85.2.jsii.tgz"
29
+ "aws-cloudfront-apigateway-lambda@2.85.3.jsii.tgz"
30
30
  ],
31
31
  "aws_solutions_constructs.aws_cloudfront_apigateway_lambda": [
32
32
  "py.typed"
@@ -35,8 +35,8 @@ kwargs = json.loads(
35
35
  "python_requires": "~=3.9",
36
36
  "install_requires": [
37
37
  "aws-cdk-lib>=2.193.0, <3.0.0",
38
- "aws-solutions-constructs.aws-cloudfront-apigateway==2.85.2",
39
- "aws-solutions-constructs.core==2.85.2",
38
+ "aws-solutions-constructs.aws-cloudfront-apigateway==2.85.3",
39
+ "aws-solutions-constructs.core==2.85.3",
40
40
  "constructs>=10.0.0, <11.0.0",
41
41
  "jsii>=1.111.0, <2.0.0",
42
42
  "publication>=0.0.3",
@@ -1,172 +1,5 @@
1
1
  r'''
2
- # aws-cloudfront-apigateway-lambda module
3
-
4
- <!--BEGIN STABILITY BANNER-->---
5
-
6
-
7
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
8
-
9
- ---
10
- <!--END STABILITY BANNER-->
11
-
12
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
13
- |:-------------|:-------------|
14
-
15
- <div style="height:8px"></div>
16
-
17
- | **Language** | **Package** |
18
- |:-------------|-----------------|
19
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_apigateway_lambda`|
20
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-apigateway-lambda`|
21
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontapigatewaylambda`|
22
-
23
- ## Overview
24
-
25
- This AWS Solutions Construct implements an AWS CloudFront fronting an Amazon API Gateway Lambda backed REST API.
26
-
27
- Here is a minimal deployable pattern definition:
28
-
29
- Typescript
30
-
31
- ```python
32
- import { Construct } from 'constructs';
33
- import { Stack, StackProps } from 'aws-cdk-lib';
34
- import { CloudFrontToApiGatewayToLambda } from '@aws-solutions-constructs/aws-cloudfront-apigateway-lambda';
35
- import * as lambda from 'aws-cdk-lib/aws-lambda';
36
-
37
- new CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', {
38
- lambdaFunctionProps: {
39
- code: lambda.Code.fromAsset(`lambda`),
40
- runtime: lambda.Runtime.NODEJS_20_X,
41
- handler: 'index.handler'
42
- },
43
- apiGatewayProps: {
44
- defaultMethodOptions: {
45
- authorizationType: api.AuthorizationType.NONE
46
- }
47
- },
48
- });
49
- ```
50
-
51
- Python
52
-
53
- ```python
54
- from aws_solutions_constructs.aws_cloudfront_apigateway_lambda import CloudFrontToApiGatewayToLambda
55
- from aws_cdk import (
56
- aws_lambda as _lambda,
57
- aws_apigateway as apigw,
58
- Stack
59
- )
60
- from constructs import Construct
61
-
62
- CloudFrontToApiGatewayToLambda(
63
- self, 'CloudFrontApiGatewayToLambda',
64
- lambda_function_props=_lambda.FunctionProps(
65
- runtime=_lambda.Runtime.PYTHON_3_11,
66
- code=_lambda.Code.from_asset('lambda'),
67
- handler='hello.handler',
68
- ),
69
- # NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
70
- # the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
71
- # (although does not *extend* that interface) this works fine when the props object reaches the
72
- # underlying TypeScript code that implements Constructs
73
- api_gateway_props=apigw.RestApiProps(
74
- default_method_options=apigw.MethodOptions(
75
- authorization_type=apigw.AuthorizationType.NONE
76
- )
77
- )
78
- )
79
- ```
80
-
81
- Java
82
-
83
- ```java
84
- import software.constructs.Construct;
85
-
86
- import software.amazon.awscdk.Stack;
87
- import software.amazon.awscdk.StackProps;
88
- import software.amazon.awscdk.services.lambda.*;
89
- import software.amazon.awscdk.services.lambda.Runtime;
90
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.*;
91
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.CloudFrontToApiGatewayToLambdaProps;
92
-
93
- new CloudFrontToApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new CloudFrontToApiGatewayToLambdaProps.Builder()
94
- .lambdaFunctionProps(new FunctionProps.Builder()
95
- .runtime(Runtime.NODEJS_20_X) // execution environment
96
- .code(Code.fromAsset("lambda")) // code loaded from the `lambda` directory (under root, next to `src`)
97
- .handler("hello.handler") // file is `hello`, function is `handler`
98
- .build())
99
- // NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
100
- // the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
101
- // (although does not *extend* that interface) this works fine when the props object reaches the
102
- // underlying TypeScript code that implements Constructs
103
- .apiGatewayProps(new RestApiProps.Builder()
104
- .defaultMethodOptions(new MethodOptions.Builder()
105
- .authorizationType(AuthorizationType.NONE)
106
- .build())
107
- .build())
108
- .build());
109
- ```
110
-
111
- ## Pattern Construct Props
112
-
113
- | **Name** | **Type** | **Description** |
114
- |:-------------|:----------------|-----------------|
115
- |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.|
116
- |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.|
117
- |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 |
118
- |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|
119
- |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
120
- | 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. |
121
- |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.|
122
- |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.|
123
-
124
- ## Pattern Properties
125
-
126
- | **Name** | **Type** | **Description** |
127
- |:-------------|:----------------|-----------------|
128
- |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|
129
- |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.|
130
- |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.|
131
- |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.|
132
- |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.|
133
- |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.|
134
- |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.|
135
-
136
- ## Default settings
137
-
138
- Out of the box implementation of the Construct without any override will set the following defaults:
139
-
140
- ### Amazon CloudFront
141
-
142
- * Configure Access logging for CloudFront Distribution
143
- * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
144
-
145
- ### Amazon API Gateway
146
-
147
- * Deploy a regional API endpoint
148
- * Enable CloudWatch logging for API Gateway
149
- * Configure least privilege access IAM role for API Gateway
150
- * Set the default authorizationType for all API methods to NONE
151
- * Enable X-Ray Tracing
152
-
153
- ### AWS Lambda Function
154
-
155
- * Configure limited privilege access IAM role for Lambda function
156
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
157
- * Enable X-Ray Tracing
158
- * Set Environment Variables
159
-
160
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
161
-
162
- ## Architecture
163
-
164
- ![Architecture Diagram](architecture.png)
165
-
166
- ---
167
-
168
-
169
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.adoc)
170
3
  '''
171
4
  from pkgutil import extend_path
172
5
  __path__ = extend_path(__path__, __name__)
@@ -35,9 +35,9 @@ import constructs._jsii
35
35
 
36
36
  __jsii_assembly__ = jsii.JSIIAssembly.load(
37
37
  "@aws-solutions-constructs/aws-cloudfront-apigateway-lambda",
38
- "2.85.2",
38
+ "2.85.3",
39
39
  __name__[0:-6],
40
- "aws-cloudfront-apigateway-lambda@2.85.2.jsii.tgz",
40
+ "aws-cloudfront-apigateway-lambda@2.85.3.jsii.tgz",
41
41
  )
42
42
 
43
43
  __all__ = [
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-cloudfront-apigateway-lambda
3
+ Version: 2.85.3
4
+ Summary: CDK Constructs for AWS Cloudfront to AWS API Gateway to AWS Lambda integration.
5
+ Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
+ Author: Amazon Web Services
7
+ License: Apache-2.0
8
+ Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: JavaScript
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Typing :: Typed
17
+ Classifier: License :: OSI Approved
18
+ Requires-Python: ~=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
+ Requires-Dist: aws-solutions-constructs.aws-cloudfront-apigateway==2.85.3
23
+ Requires-Dist: aws-solutions-constructs.core==2.85.3
24
+ Requires-Dist: constructs<11.0.0,>=10.0.0
25
+ Requires-Dist: jsii<2.0.0,>=1.111.0
26
+ Requires-Dist: publication>=0.0.3
27
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
28
+
29
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.adoc)
@@ -11,4 +11,4 @@ src/aws_solutions_constructs.aws_cloudfront_apigateway_lambda.egg-info/top_level
11
11
  src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/__init__.py
12
12
  src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/py.typed
13
13
  src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/_jsii/__init__.py
14
- src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/_jsii/aws-cloudfront-apigateway-lambda@2.85.2.jsii.tgz
14
+ src/aws_solutions_constructs/aws_cloudfront_apigateway_lambda/_jsii/aws-cloudfront-apigateway-lambda@2.85.3.jsii.tgz
@@ -1,6 +1,6 @@
1
1
  aws-cdk-lib<3.0.0,>=2.193.0
2
- aws-solutions-constructs.aws-cloudfront-apigateway==2.85.2
3
- aws-solutions-constructs.core==2.85.2
2
+ aws-solutions-constructs.aws-cloudfront-apigateway==2.85.3
3
+ aws-solutions-constructs.core==2.85.3
4
4
  constructs<11.0.0,>=10.0.0
5
5
  jsii<2.0.0,>=1.111.0
6
6
  publication>=0.0.3
@@ -1,196 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-cloudfront-apigateway-lambda
3
- Version: 2.85.2
4
- Summary: CDK Constructs for AWS Cloudfront to AWS API Gateway to AWS Lambda integration.
5
- Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
- Author: Amazon Web Services
7
- License: Apache-2.0
8
- Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: JavaScript
12
- Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Typing :: Typed
17
- Classifier: License :: OSI Approved
18
- Requires-Python: ~=3.9
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
- Requires-Dist: aws-solutions-constructs.aws-cloudfront-apigateway==2.85.2
23
- Requires-Dist: aws-solutions-constructs.core==2.85.2
24
- Requires-Dist: constructs<11.0.0,>=10.0.0
25
- Requires-Dist: jsii<2.0.0,>=1.111.0
26
- Requires-Dist: publication>=0.0.3
27
- Requires-Dist: typeguard<4.3.0,>=2.13.3
28
-
29
- # aws-cloudfront-apigateway-lambda module
30
-
31
- <!--BEGIN STABILITY BANNER-->---
32
-
33
-
34
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
35
-
36
- ---
37
- <!--END STABILITY BANNER-->
38
-
39
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
40
- |:-------------|:-------------|
41
-
42
- <div style="height:8px"></div>
43
-
44
- | **Language** | **Package** |
45
- |:-------------|-----------------|
46
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_apigateway_lambda`|
47
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-apigateway-lambda`|
48
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontapigatewaylambda`|
49
-
50
- ## Overview
51
-
52
- This AWS Solutions Construct implements an AWS CloudFront fronting an Amazon API Gateway Lambda backed REST API.
53
-
54
- Here is a minimal deployable pattern definition:
55
-
56
- Typescript
57
-
58
- ```python
59
- import { Construct } from 'constructs';
60
- import { Stack, StackProps } from 'aws-cdk-lib';
61
- import { CloudFrontToApiGatewayToLambda } from '@aws-solutions-constructs/aws-cloudfront-apigateway-lambda';
62
- import * as lambda from 'aws-cdk-lib/aws-lambda';
63
-
64
- new CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', {
65
- lambdaFunctionProps: {
66
- code: lambda.Code.fromAsset(`lambda`),
67
- runtime: lambda.Runtime.NODEJS_20_X,
68
- handler: 'index.handler'
69
- },
70
- apiGatewayProps: {
71
- defaultMethodOptions: {
72
- authorizationType: api.AuthorizationType.NONE
73
- }
74
- },
75
- });
76
- ```
77
-
78
- Python
79
-
80
- ```python
81
- from aws_solutions_constructs.aws_cloudfront_apigateway_lambda import CloudFrontToApiGatewayToLambda
82
- from aws_cdk import (
83
- aws_lambda as _lambda,
84
- aws_apigateway as apigw,
85
- Stack
86
- )
87
- from constructs import Construct
88
-
89
- CloudFrontToApiGatewayToLambda(
90
- self, 'CloudFrontApiGatewayToLambda',
91
- lambda_function_props=_lambda.FunctionProps(
92
- runtime=_lambda.Runtime.PYTHON_3_11,
93
- code=_lambda.Code.from_asset('lambda'),
94
- handler='hello.handler',
95
- ),
96
- # NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
97
- # the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
98
- # (although does not *extend* that interface) this works fine when the props object reaches the
99
- # underlying TypeScript code that implements Constructs
100
- api_gateway_props=apigw.RestApiProps(
101
- default_method_options=apigw.MethodOptions(
102
- authorization_type=apigw.AuthorizationType.NONE
103
- )
104
- )
105
- )
106
- ```
107
-
108
- Java
109
-
110
- ```java
111
- import software.constructs.Construct;
112
-
113
- import software.amazon.awscdk.Stack;
114
- import software.amazon.awscdk.StackProps;
115
- import software.amazon.awscdk.services.lambda.*;
116
- import software.amazon.awscdk.services.lambda.Runtime;
117
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.*;
118
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.CloudFrontToApiGatewayToLambdaProps;
119
-
120
- new CloudFrontToApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new CloudFrontToApiGatewayToLambdaProps.Builder()
121
- .lambdaFunctionProps(new FunctionProps.Builder()
122
- .runtime(Runtime.NODEJS_20_X) // execution environment
123
- .code(Code.fromAsset("lambda")) // code loaded from the `lambda` directory (under root, next to `src`)
124
- .handler("hello.handler") // file is `hello`, function is `handler`
125
- .build())
126
- // NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
127
- // the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
128
- // (although does not *extend* that interface) this works fine when the props object reaches the
129
- // underlying TypeScript code that implements Constructs
130
- .apiGatewayProps(new RestApiProps.Builder()
131
- .defaultMethodOptions(new MethodOptions.Builder()
132
- .authorizationType(AuthorizationType.NONE)
133
- .build())
134
- .build())
135
- .build());
136
- ```
137
-
138
- ## Pattern Construct Props
139
-
140
- | **Name** | **Type** | **Description** |
141
- |:-------------|:----------------|-----------------|
142
- |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.|
143
- |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.|
144
- |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 |
145
- |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|
146
- |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
147
- | 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. |
148
- |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.|
149
- |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.|
150
-
151
- ## Pattern Properties
152
-
153
- | **Name** | **Type** | **Description** |
154
- |:-------------|:----------------|-----------------|
155
- |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|
156
- |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.|
157
- |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.|
158
- |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.|
159
- |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.|
160
- |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.|
161
- |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.|
162
-
163
- ## Default settings
164
-
165
- Out of the box implementation of the Construct without any override will set the following defaults:
166
-
167
- ### Amazon CloudFront
168
-
169
- * Configure Access logging for CloudFront Distribution
170
- * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
171
-
172
- ### Amazon API Gateway
173
-
174
- * Deploy a regional API endpoint
175
- * Enable CloudWatch logging for API Gateway
176
- * Configure least privilege access IAM role for API Gateway
177
- * Set the default authorizationType for all API methods to NONE
178
- * Enable X-Ray Tracing
179
-
180
- ### AWS Lambda Function
181
-
182
- * Configure limited privilege access IAM role for Lambda function
183
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
184
- * Enable X-Ray Tracing
185
- * Set Environment Variables
186
-
187
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
188
-
189
- ## Architecture
190
-
191
- ![Architecture Diagram](architecture.png)
192
-
193
- ---
194
-
195
-
196
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,168 +0,0 @@
1
- # aws-cloudfront-apigateway-lambda module
2
-
3
- <!--BEGIN STABILITY BANNER-->---
4
-
5
-
6
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
7
-
8
- ---
9
- <!--END STABILITY BANNER-->
10
-
11
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
12
- |:-------------|:-------------|
13
-
14
- <div style="height:8px"></div>
15
-
16
- | **Language** | **Package** |
17
- |:-------------|-----------------|
18
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_apigateway_lambda`|
19
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-apigateway-lambda`|
20
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontapigatewaylambda`|
21
-
22
- ## Overview
23
-
24
- This AWS Solutions Construct implements an AWS CloudFront fronting an Amazon API Gateway Lambda backed REST API.
25
-
26
- Here is a minimal deployable pattern definition:
27
-
28
- Typescript
29
-
30
- ```python
31
- import { Construct } from 'constructs';
32
- import { Stack, StackProps } from 'aws-cdk-lib';
33
- import { CloudFrontToApiGatewayToLambda } from '@aws-solutions-constructs/aws-cloudfront-apigateway-lambda';
34
- import * as lambda from 'aws-cdk-lib/aws-lambda';
35
-
36
- new CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', {
37
- lambdaFunctionProps: {
38
- code: lambda.Code.fromAsset(`lambda`),
39
- runtime: lambda.Runtime.NODEJS_20_X,
40
- handler: 'index.handler'
41
- },
42
- apiGatewayProps: {
43
- defaultMethodOptions: {
44
- authorizationType: api.AuthorizationType.NONE
45
- }
46
- },
47
- });
48
- ```
49
-
50
- Python
51
-
52
- ```python
53
- from aws_solutions_constructs.aws_cloudfront_apigateway_lambda import CloudFrontToApiGatewayToLambda
54
- from aws_cdk import (
55
- aws_lambda as _lambda,
56
- aws_apigateway as apigw,
57
- Stack
58
- )
59
- from constructs import Construct
60
-
61
- CloudFrontToApiGatewayToLambda(
62
- self, 'CloudFrontApiGatewayToLambda',
63
- lambda_function_props=_lambda.FunctionProps(
64
- runtime=_lambda.Runtime.PYTHON_3_11,
65
- code=_lambda.Code.from_asset('lambda'),
66
- handler='hello.handler',
67
- ),
68
- # NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
69
- # the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
70
- # (although does not *extend* that interface) this works fine when the props object reaches the
71
- # underlying TypeScript code that implements Constructs
72
- api_gateway_props=apigw.RestApiProps(
73
- default_method_options=apigw.MethodOptions(
74
- authorization_type=apigw.AuthorizationType.NONE
75
- )
76
- )
77
- )
78
- ```
79
-
80
- Java
81
-
82
- ```java
83
- import software.constructs.Construct;
84
-
85
- import software.amazon.awscdk.Stack;
86
- import software.amazon.awscdk.StackProps;
87
- import software.amazon.awscdk.services.lambda.*;
88
- import software.amazon.awscdk.services.lambda.Runtime;
89
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.*;
90
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.CloudFrontToApiGatewayToLambdaProps;
91
-
92
- new CloudFrontToApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new CloudFrontToApiGatewayToLambdaProps.Builder()
93
- .lambdaFunctionProps(new FunctionProps.Builder()
94
- .runtime(Runtime.NODEJS_20_X) // execution environment
95
- .code(Code.fromAsset("lambda")) // code loaded from the `lambda` directory (under root, next to `src`)
96
- .handler("hello.handler") // file is `hello`, function is `handler`
97
- .build())
98
- // NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
99
- // the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
100
- // (although does not *extend* that interface) this works fine when the props object reaches the
101
- // underlying TypeScript code that implements Constructs
102
- .apiGatewayProps(new RestApiProps.Builder()
103
- .defaultMethodOptions(new MethodOptions.Builder()
104
- .authorizationType(AuthorizationType.NONE)
105
- .build())
106
- .build())
107
- .build());
108
- ```
109
-
110
- ## Pattern Construct Props
111
-
112
- | **Name** | **Type** | **Description** |
113
- |:-------------|:----------------|-----------------|
114
- |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.|
115
- |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.|
116
- |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 |
117
- |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|
118
- |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
119
- | 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. |
120
- |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.|
121
- |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.|
122
-
123
- ## Pattern Properties
124
-
125
- | **Name** | **Type** | **Description** |
126
- |:-------------|:----------------|-----------------|
127
- |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|
128
- |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.|
129
- |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.|
130
- |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.|
131
- |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.|
132
- |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.|
133
- |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.|
134
-
135
- ## Default settings
136
-
137
- Out of the box implementation of the Construct without any override will set the following defaults:
138
-
139
- ### Amazon CloudFront
140
-
141
- * Configure Access logging for CloudFront Distribution
142
- * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
143
-
144
- ### Amazon API Gateway
145
-
146
- * Deploy a regional API endpoint
147
- * Enable CloudWatch logging for API Gateway
148
- * Configure least privilege access IAM role for API Gateway
149
- * Set the default authorizationType for all API methods to NONE
150
- * Enable X-Ray Tracing
151
-
152
- ### AWS Lambda Function
153
-
154
- * Configure limited privilege access IAM role for Lambda function
155
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
156
- * Enable X-Ray Tracing
157
- * Set Environment Variables
158
-
159
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
160
-
161
- ## Architecture
162
-
163
- ![Architecture Diagram](architecture.png)
164
-
165
- ---
166
-
167
-
168
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,196 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-cloudfront-apigateway-lambda
3
- Version: 2.85.2
4
- Summary: CDK Constructs for AWS Cloudfront to AWS API Gateway to AWS Lambda integration.
5
- Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
- Author: Amazon Web Services
7
- License: Apache-2.0
8
- Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: JavaScript
12
- Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Typing :: Typed
17
- Classifier: License :: OSI Approved
18
- Requires-Python: ~=3.9
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
- Requires-Dist: aws-solutions-constructs.aws-cloudfront-apigateway==2.85.2
23
- Requires-Dist: aws-solutions-constructs.core==2.85.2
24
- Requires-Dist: constructs<11.0.0,>=10.0.0
25
- Requires-Dist: jsii<2.0.0,>=1.111.0
26
- Requires-Dist: publication>=0.0.3
27
- Requires-Dist: typeguard<4.3.0,>=2.13.3
28
-
29
- # aws-cloudfront-apigateway-lambda module
30
-
31
- <!--BEGIN STABILITY BANNER-->---
32
-
33
-
34
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
35
-
36
- ---
37
- <!--END STABILITY BANNER-->
38
-
39
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
40
- |:-------------|:-------------|
41
-
42
- <div style="height:8px"></div>
43
-
44
- | **Language** | **Package** |
45
- |:-------------|-----------------|
46
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_apigateway_lambda`|
47
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-apigateway-lambda`|
48
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontapigatewaylambda`|
49
-
50
- ## Overview
51
-
52
- This AWS Solutions Construct implements an AWS CloudFront fronting an Amazon API Gateway Lambda backed REST API.
53
-
54
- Here is a minimal deployable pattern definition:
55
-
56
- Typescript
57
-
58
- ```python
59
- import { Construct } from 'constructs';
60
- import { Stack, StackProps } from 'aws-cdk-lib';
61
- import { CloudFrontToApiGatewayToLambda } from '@aws-solutions-constructs/aws-cloudfront-apigateway-lambda';
62
- import * as lambda from 'aws-cdk-lib/aws-lambda';
63
-
64
- new CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', {
65
- lambdaFunctionProps: {
66
- code: lambda.Code.fromAsset(`lambda`),
67
- runtime: lambda.Runtime.NODEJS_20_X,
68
- handler: 'index.handler'
69
- },
70
- apiGatewayProps: {
71
- defaultMethodOptions: {
72
- authorizationType: api.AuthorizationType.NONE
73
- }
74
- },
75
- });
76
- ```
77
-
78
- Python
79
-
80
- ```python
81
- from aws_solutions_constructs.aws_cloudfront_apigateway_lambda import CloudFrontToApiGatewayToLambda
82
- from aws_cdk import (
83
- aws_lambda as _lambda,
84
- aws_apigateway as apigw,
85
- Stack
86
- )
87
- from constructs import Construct
88
-
89
- CloudFrontToApiGatewayToLambda(
90
- self, 'CloudFrontApiGatewayToLambda',
91
- lambda_function_props=_lambda.FunctionProps(
92
- runtime=_lambda.Runtime.PYTHON_3_11,
93
- code=_lambda.Code.from_asset('lambda'),
94
- handler='hello.handler',
95
- ),
96
- # NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
97
- # the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
98
- # (although does not *extend* that interface) this works fine when the props object reaches the
99
- # underlying TypeScript code that implements Constructs
100
- api_gateway_props=apigw.RestApiProps(
101
- default_method_options=apigw.MethodOptions(
102
- authorization_type=apigw.AuthorizationType.NONE
103
- )
104
- )
105
- )
106
- ```
107
-
108
- Java
109
-
110
- ```java
111
- import software.constructs.Construct;
112
-
113
- import software.amazon.awscdk.Stack;
114
- import software.amazon.awscdk.StackProps;
115
- import software.amazon.awscdk.services.lambda.*;
116
- import software.amazon.awscdk.services.lambda.Runtime;
117
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.*;
118
- import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.CloudFrontToApiGatewayToLambdaProps;
119
-
120
- new CloudFrontToApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new CloudFrontToApiGatewayToLambdaProps.Builder()
121
- .lambdaFunctionProps(new FunctionProps.Builder()
122
- .runtime(Runtime.NODEJS_20_X) // execution environment
123
- .code(Code.fromAsset("lambda")) // code loaded from the `lambda` directory (under root, next to `src`)
124
- .handler("hello.handler") // file is `hello`, function is `handler`
125
- .build())
126
- // NOTE - we use RestApiProps here because the actual type, LambdaRestApiProps requires
127
- // the handler function which does not yet exist. As RestApiProps is a subset of of LambdaRestApiProps
128
- // (although does not *extend* that interface) this works fine when the props object reaches the
129
- // underlying TypeScript code that implements Constructs
130
- .apiGatewayProps(new RestApiProps.Builder()
131
- .defaultMethodOptions(new MethodOptions.Builder()
132
- .authorizationType(AuthorizationType.NONE)
133
- .build())
134
- .build())
135
- .build());
136
- ```
137
-
138
- ## Pattern Construct Props
139
-
140
- | **Name** | **Type** | **Description** |
141
- |:-------------|:----------------|-----------------|
142
- |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.|
143
- |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.|
144
- |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 |
145
- |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|
146
- |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
147
- | 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. |
148
- |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.|
149
- |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.|
150
-
151
- ## Pattern Properties
152
-
153
- | **Name** | **Type** | **Description** |
154
- |:-------------|:----------------|-----------------|
155
- |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|
156
- |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.|
157
- |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.|
158
- |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.|
159
- |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.|
160
- |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.|
161
- |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.|
162
-
163
- ## Default settings
164
-
165
- Out of the box implementation of the Construct without any override will set the following defaults:
166
-
167
- ### Amazon CloudFront
168
-
169
- * Configure Access logging for CloudFront Distribution
170
- * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
171
-
172
- ### Amazon API Gateway
173
-
174
- * Deploy a regional API endpoint
175
- * Enable CloudWatch logging for API Gateway
176
- * Configure least privilege access IAM role for API Gateway
177
- * Set the default authorizationType for all API methods to NONE
178
- * Enable X-Ray Tracing
179
-
180
- ### AWS Lambda Function
181
-
182
- * Configure limited privilege access IAM role for Lambda function
183
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
184
- * Enable X-Ray Tracing
185
- * Set Environment Variables
186
-
187
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
188
-
189
- ## Architecture
190
-
191
- ![Architecture Diagram](architecture.png)
192
-
193
- ---
194
-
195
-
196
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.