aws-solutions-constructs.aws-alb-lambda 2.85.2__tar.gz → 2.85.4__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_alb_lambda-2.85.4/PKG-INFO +28 -0
  2. aws_solutions_constructs_aws_alb_lambda-2.85.4/README.md +1 -0
  3. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/setup.py +3 -3
  4. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/src/aws_solutions_constructs/aws_alb_lambda/__init__.py +1 -193
  5. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/src/aws_solutions_constructs/aws_alb_lambda/_jsii/__init__.py +2 -2
  6. aws_solutions_constructs_aws_alb_lambda-2.85.4/src/aws_solutions_constructs/aws_alb_lambda/_jsii/aws-alb-lambda@2.85.4.jsii.tgz +0 -0
  7. aws_solutions_constructs_aws_alb_lambda-2.85.4/src/aws_solutions_constructs.aws_alb_lambda.egg-info/PKG-INFO +28 -0
  8. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/src/aws_solutions_constructs.aws_alb_lambda.egg-info/SOURCES.txt +1 -1
  9. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/src/aws_solutions_constructs.aws_alb_lambda.egg-info/requires.txt +1 -1
  10. aws_solutions_constructs_aws_alb_lambda-2.85.2/PKG-INFO +0 -220
  11. aws_solutions_constructs_aws_alb_lambda-2.85.2/README.md +0 -193
  12. aws_solutions_constructs_aws_alb_lambda-2.85.2/src/aws_solutions_constructs/aws_alb_lambda/_jsii/aws-alb-lambda@2.85.2.jsii.tgz +0 -0
  13. aws_solutions_constructs_aws_alb_lambda-2.85.2/src/aws_solutions_constructs.aws_alb_lambda.egg-info/PKG-INFO +0 -220
  14. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/LICENSE +0 -0
  15. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/MANIFEST.in +0 -0
  16. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/pyproject.toml +0 -0
  17. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/setup.cfg +0 -0
  18. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/src/aws_solutions_constructs/aws_alb_lambda/py.typed +0 -0
  19. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/src/aws_solutions_constructs.aws_alb_lambda.egg-info/dependency_links.txt +0 -0
  20. {aws_solutions_constructs_aws_alb_lambda-2.85.2 → aws_solutions_constructs_aws_alb_lambda-2.85.4}/src/aws_solutions_constructs.aws_alb_lambda.egg-info/top_level.txt +0 -0
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-alb-lambda
3
+ Version: 2.85.4
4
+ Summary: CDK Constructs for Application Load Balancer 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.core==2.85.4
23
+ Requires-Dist: constructs<11.0.0,>=10.0.0
24
+ Requires-Dist: jsii<2.0.0,>=1.111.0
25
+ Requires-Dist: publication>=0.0.3
26
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
27
+
28
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-alb-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-alb-lambda/README.adoc)
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "aws-solutions-constructs.aws-alb-lambda",
8
- "version": "2.85.2",
8
+ "version": "2.85.4",
9
9
  "description": "CDK Constructs for Application Load Balancer 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_alb_lambda._jsii": [
29
- "aws-alb-lambda@2.85.2.jsii.tgz"
29
+ "aws-alb-lambda@2.85.4.jsii.tgz"
30
30
  ],
31
31
  "aws_solutions_constructs.aws_alb_lambda": [
32
32
  "py.typed"
@@ -35,7 +35,7 @@ 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.core==2.85.2",
38
+ "aws-solutions-constructs.core==2.85.4",
39
39
  "constructs>=10.0.0, <11.0.0",
40
40
  "jsii>=1.111.0, <2.0.0",
41
41
  "publication>=0.0.3",
@@ -1,197 +1,5 @@
1
1
  r'''
2
- # aws-alb-lambda module
3
-
4
- <!--BEGIN STABILITY BANNER-->---
5
-
6
-
7
- ![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
8
-
9
- > All classes are under active development and subject to non-backward compatible changes or removal in any
10
- > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.
11
- > This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
12
-
13
- ---
14
- <!--END STABILITY BANNER-->
15
-
16
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
17
- |:-------------|:-------------|
18
-
19
- <div style="height:8px"></div>
20
-
21
- | **Language** | **Package** |
22
- |:-------------|-----------------|
23
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_alb_lambda`|
24
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-alb-lambda`|
25
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.alblambda`|
26
-
27
- ## Overview
28
-
29
- This AWS Solutions Construct implements an an Application Load Balancer to an AWS Lambda function
30
-
31
- Here is a minimal deployable pattern definition:
32
-
33
- Typescript
34
-
35
- ```python
36
- import { Construct } from 'constructs';
37
- import { Stack, StackProps } from 'aws-cdk-lib';
38
- import { AlbToLambda, AlbToLambdaProps } from '@aws-solutions-constructs/aws-alb-lambda';
39
- import * as acm from 'aws-cdk-lib/aws-certificatemanager';
40
- import * as lambda from 'aws-cdk-lib/aws-lambda';
41
-
42
- // Obtain a pre-existing certificate from your account
43
- const certificate = acm.Certificate.fromCertificateArn(
44
- this,
45
- 'existing-cert',
46
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
47
- );
48
-
49
- const constructProps: AlbToLambdaProps = {
50
- lambdaFunctionProps: {
51
- code: lambda.Code.fromAsset(`lambda`),
52
- runtime: lambda.Runtime.NODEJS_20_X,
53
- handler: 'index.handler'
54
- },
55
- listenerProps: {
56
- certificates: [certificate]
57
- },
58
- publicApi: true
59
- };
60
-
61
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
62
- // and region be provided when creating the stack
63
- //
64
- // new MyStack(app, 'id', {env: {account: '123456789012', region: 'us-east-1' }});
65
- new AlbToLambda(this, 'new-construct', constructProps);
66
- ```
67
-
68
- Python
69
-
70
- ```python
71
- from aws_solutions_constructs.aws_alb_lambda import AlbToLambda, AlbToLambdaProps
72
- from aws_cdk import (
73
- aws_certificatemanager as acm,
74
- aws_lambda as _lambda,
75
- aws_elasticloadbalancingv2 as alb,
76
- Stack
77
- )
78
- from constructs import Construct
79
-
80
- # Obtain a pre-existing certificate from your account
81
- certificate = acm.Certificate.from_certificate_arn(
82
- self,
83
- 'existing-cert',
84
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
85
- )
86
-
87
- # Note - all alb constructs turn on ELB logging by default, so require that an environment including account
88
- # and region be provided when creating the stack
89
- #
90
- # MyStack(app, 'id', env=cdk.Environment(account='123456789012', region='us-east-1'))
91
- AlbToLambda(self, 'new-construct',
92
- lambda_function_props=_lambda.FunctionProps(
93
- runtime=_lambda.Runtime.PYTHON_3_11,
94
- code=_lambda.Code.from_asset('lambda'),
95
- handler='index.handler',
96
- ),
97
- listener_props=alb.BaseApplicationListenerProps(
98
- certificates=[certificate]
99
- ),
100
- public_api=True)
101
- ```
102
-
103
- Java
104
-
105
- ```java
106
- import software.constructs.Construct;
107
- import java.util.List;
108
-
109
- import software.amazon.awscdk.Stack;
110
- import software.amazon.awscdk.StackProps;
111
- import software.amazon.awscdk.services.elasticloadbalancingv2.*;
112
- import software.amazon.awscdk.services.lambda.*;
113
- import software.amazon.awscdk.services.lambda.Runtime;
114
- import software.amazon.awsconstructs.services.alblambda.*;
115
-
116
- // Obtain a pre-existing certificate from your account
117
- ListenerCertificate listenerCertificate = ListenerCertificate
118
- .fromArn("arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012");
119
-
120
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
121
- // and region be provided when creating the stack
122
- //
123
- // new MyStack(app, "id", StackProps.builder()
124
- // .env(Environment.builder()
125
- // .account("123456789012")
126
- // .region("us-east-1")
127
- // .build());
128
- new AlbToLambda(this, "AlbToLambdaPattern", new AlbToLambdaProps.Builder()
129
- .lambdaFunctionProps(new FunctionProps.Builder()
130
- .runtime(Runtime.NODEJS_20_X)
131
- .code(Code.fromAsset("lambda"))
132
- .handler("index.handler")
133
- .build())
134
- .listenerProps(new BaseApplicationListenerProps.Builder()
135
- .certificates(List.of(listenerCertificate))
136
- .build())
137
- .publicApi(true)
138
- .build());
139
- ```
140
-
141
- ## Pattern Construct Props
142
-
143
- | **Name** | **Type** | **Description** |
144
- |:-------------|:----------------|-----------------|
145
- | loadBalancerProps? | [elasticloadbalancingv2.ApplicationLoadBalancerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps.html) | Optional custom properties for a new loadBalancer. Providing both this and existingLoadBalancer is an error. This cannot specify a VPC, it will use the VPC in existingVpc or the VPC created by the construct. |
146
- | existingLoadBalancerObj? | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | Existing Application Load Balancer to incorporate into the construct architecture. Providing both this and loadBalancerProps is an error. The VPC containing this loadBalancer must match the VPC provided in existingVpc. |
147
- | listenerProps? | [ApplicationListenerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListenerProps.html) | Props to define the listener. Must be provided when adding the listener to an ALB (eg - when creating the alb), may not be provided when adding a second target to an already established listener. When provided, must include either a certificate or protocol: HTTP |
148
- | targetProps? | [ApplicationTargetGroupProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroupProps.html) | Optional custom properties for a new target group. While this is a standard attribute of props for ALB constructs, there are few pertinent properties for a Lambda target. |
149
- | ruleProps? | [AddRuleProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.AddRuleProps.html) | Rules for directing traffic to the target being created. May not be specified for the first listener added to an ALB, and must be specified for the second target added to a listener. Add a second target by instantiating this construct a second time and providing the existingAlb from the first instantiation. |
150
- | vpcProps? | [ec2.VpcProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html) | Optional custom properties for a VPC the construct will create. This VPC will be used by the new ALB and any Private Hosted Zone the construct creates (that's why loadBalancerProps and privateHostedZoneProps can't include a VPC). Providing both this and existingVpc is an error. |
151
- |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.|
152
- |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.|
153
- | existingVpc? | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | An existing VPC in which to deploy the construct. Providing both this and vpcProps is an error. If the client provides an existing load balancer and/or existing Private Hosted Zone, those constructs must exist in this VPC. |
154
- | logAlbAccessLogs? | boolean| Whether to turn on Access Logs for the Application Load Balancer. Uses an S3 bucket with associated storage costs.Enabling Access Logging is a best practice. default - true |
155
- | albLoggingBucketProps? | [s3.BucketProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html) | Optional properties to customize the bucket used to store the ALB Access Logs. Supplying this and setting logAccessLogs to false is an error. @default - none |
156
- | publicApi | boolean | Whether the construct is deploying a private or public API. This has implications for the VPC and ALB. |
157
-
158
- ## Pattern Properties
159
-
160
- | **Name** | **Type** | **Description** |
161
- |:-------------|:----------------|-----------------|
162
- | vpc | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | The VPC used by the construct (whether created by the construct or providedb by the client) |
163
- | loadBalancer | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | The Load Balancer used by the construct (whether created by the construct or provided by the client) |
164
- |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 used in the pattern.|
165
- | listener | [`elb.ApplicationListener`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListener.html) | The listener used by this pattern. |
166
-
167
- ## Default settings
168
-
169
- Out of the box implementation of the Construct without any override will set the following defaults:
170
-
171
- ### Application Load Balancer
172
-
173
- * Creates or configures an Application Load Balancer with:
174
-
175
- * Required listeners
176
- * New target group with routing rules if appropriate
177
-
178
- ### AWS Lambda Function
179
-
180
- * Configure limited privilege access IAM role for Lambda function
181
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
182
- * Enable X-Ray Tracing
183
- * Set Environment Variables
184
-
185
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
186
-
187
- ## Architecture
188
-
189
- ![Architecture Diagram](architecture.png)
190
-
191
- ---
192
-
193
-
194
- © 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-alb-lambda/README.adoc)
195
3
  '''
196
4
  from pkgutil import extend_path
197
5
  __path__ = extend_path(__path__, __name__)
@@ -34,9 +34,9 @@ import constructs._jsii
34
34
 
35
35
  __jsii_assembly__ = jsii.JSIIAssembly.load(
36
36
  "@aws-solutions-constructs/aws-alb-lambda",
37
- "2.85.2",
37
+ "2.85.4",
38
38
  __name__[0:-6],
39
- "aws-alb-lambda@2.85.2.jsii.tgz",
39
+ "aws-alb-lambda@2.85.4.jsii.tgz",
40
40
  )
41
41
 
42
42
  __all__ = [
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-alb-lambda
3
+ Version: 2.85.4
4
+ Summary: CDK Constructs for Application Load Balancer 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.core==2.85.4
23
+ Requires-Dist: constructs<11.0.0,>=10.0.0
24
+ Requires-Dist: jsii<2.0.0,>=1.111.0
25
+ Requires-Dist: publication>=0.0.3
26
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
27
+
28
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-alb-lambda/README.adoc)
@@ -11,4 +11,4 @@ src/aws_solutions_constructs.aws_alb_lambda.egg-info/top_level.txt
11
11
  src/aws_solutions_constructs/aws_alb_lambda/__init__.py
12
12
  src/aws_solutions_constructs/aws_alb_lambda/py.typed
13
13
  src/aws_solutions_constructs/aws_alb_lambda/_jsii/__init__.py
14
- src/aws_solutions_constructs/aws_alb_lambda/_jsii/aws-alb-lambda@2.85.2.jsii.tgz
14
+ src/aws_solutions_constructs/aws_alb_lambda/_jsii/aws-alb-lambda@2.85.4.jsii.tgz
@@ -1,5 +1,5 @@
1
1
  aws-cdk-lib<3.0.0,>=2.193.0
2
- aws-solutions-constructs.core==2.85.2
2
+ aws-solutions-constructs.core==2.85.4
3
3
  constructs<11.0.0,>=10.0.0
4
4
  jsii<2.0.0,>=1.111.0
5
5
  publication>=0.0.3
@@ -1,220 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-alb-lambda
3
- Version: 2.85.2
4
- Summary: CDK Constructs for Application Load Balancer 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.core==2.85.2
23
- Requires-Dist: constructs<11.0.0,>=10.0.0
24
- Requires-Dist: jsii<2.0.0,>=1.111.0
25
- Requires-Dist: publication>=0.0.3
26
- Requires-Dist: typeguard<4.3.0,>=2.13.3
27
-
28
- # aws-alb-lambda module
29
-
30
- <!--BEGIN STABILITY BANNER-->---
31
-
32
-
33
- ![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
34
-
35
- > All classes are under active development and subject to non-backward compatible changes or removal in any
36
- > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.
37
- > This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
38
-
39
- ---
40
- <!--END STABILITY BANNER-->
41
-
42
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
43
- |:-------------|:-------------|
44
-
45
- <div style="height:8px"></div>
46
-
47
- | **Language** | **Package** |
48
- |:-------------|-----------------|
49
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_alb_lambda`|
50
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-alb-lambda`|
51
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.alblambda`|
52
-
53
- ## Overview
54
-
55
- This AWS Solutions Construct implements an an Application Load Balancer to an AWS Lambda function
56
-
57
- Here is a minimal deployable pattern definition:
58
-
59
- Typescript
60
-
61
- ```python
62
- import { Construct } from 'constructs';
63
- import { Stack, StackProps } from 'aws-cdk-lib';
64
- import { AlbToLambda, AlbToLambdaProps } from '@aws-solutions-constructs/aws-alb-lambda';
65
- import * as acm from 'aws-cdk-lib/aws-certificatemanager';
66
- import * as lambda from 'aws-cdk-lib/aws-lambda';
67
-
68
- // Obtain a pre-existing certificate from your account
69
- const certificate = acm.Certificate.fromCertificateArn(
70
- this,
71
- 'existing-cert',
72
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
73
- );
74
-
75
- const constructProps: AlbToLambdaProps = {
76
- lambdaFunctionProps: {
77
- code: lambda.Code.fromAsset(`lambda`),
78
- runtime: lambda.Runtime.NODEJS_20_X,
79
- handler: 'index.handler'
80
- },
81
- listenerProps: {
82
- certificates: [certificate]
83
- },
84
- publicApi: true
85
- };
86
-
87
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
88
- // and region be provided when creating the stack
89
- //
90
- // new MyStack(app, 'id', {env: {account: '123456789012', region: 'us-east-1' }});
91
- new AlbToLambda(this, 'new-construct', constructProps);
92
- ```
93
-
94
- Python
95
-
96
- ```python
97
- from aws_solutions_constructs.aws_alb_lambda import AlbToLambda, AlbToLambdaProps
98
- from aws_cdk import (
99
- aws_certificatemanager as acm,
100
- aws_lambda as _lambda,
101
- aws_elasticloadbalancingv2 as alb,
102
- Stack
103
- )
104
- from constructs import Construct
105
-
106
- # Obtain a pre-existing certificate from your account
107
- certificate = acm.Certificate.from_certificate_arn(
108
- self,
109
- 'existing-cert',
110
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
111
- )
112
-
113
- # Note - all alb constructs turn on ELB logging by default, so require that an environment including account
114
- # and region be provided when creating the stack
115
- #
116
- # MyStack(app, 'id', env=cdk.Environment(account='123456789012', region='us-east-1'))
117
- AlbToLambda(self, 'new-construct',
118
- lambda_function_props=_lambda.FunctionProps(
119
- runtime=_lambda.Runtime.PYTHON_3_11,
120
- code=_lambda.Code.from_asset('lambda'),
121
- handler='index.handler',
122
- ),
123
- listener_props=alb.BaseApplicationListenerProps(
124
- certificates=[certificate]
125
- ),
126
- public_api=True)
127
- ```
128
-
129
- Java
130
-
131
- ```java
132
- import software.constructs.Construct;
133
- import java.util.List;
134
-
135
- import software.amazon.awscdk.Stack;
136
- import software.amazon.awscdk.StackProps;
137
- import software.amazon.awscdk.services.elasticloadbalancingv2.*;
138
- import software.amazon.awscdk.services.lambda.*;
139
- import software.amazon.awscdk.services.lambda.Runtime;
140
- import software.amazon.awsconstructs.services.alblambda.*;
141
-
142
- // Obtain a pre-existing certificate from your account
143
- ListenerCertificate listenerCertificate = ListenerCertificate
144
- .fromArn("arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012");
145
-
146
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
147
- // and region be provided when creating the stack
148
- //
149
- // new MyStack(app, "id", StackProps.builder()
150
- // .env(Environment.builder()
151
- // .account("123456789012")
152
- // .region("us-east-1")
153
- // .build());
154
- new AlbToLambda(this, "AlbToLambdaPattern", new AlbToLambdaProps.Builder()
155
- .lambdaFunctionProps(new FunctionProps.Builder()
156
- .runtime(Runtime.NODEJS_20_X)
157
- .code(Code.fromAsset("lambda"))
158
- .handler("index.handler")
159
- .build())
160
- .listenerProps(new BaseApplicationListenerProps.Builder()
161
- .certificates(List.of(listenerCertificate))
162
- .build())
163
- .publicApi(true)
164
- .build());
165
- ```
166
-
167
- ## Pattern Construct Props
168
-
169
- | **Name** | **Type** | **Description** |
170
- |:-------------|:----------------|-----------------|
171
- | loadBalancerProps? | [elasticloadbalancingv2.ApplicationLoadBalancerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps.html) | Optional custom properties for a new loadBalancer. Providing both this and existingLoadBalancer is an error. This cannot specify a VPC, it will use the VPC in existingVpc or the VPC created by the construct. |
172
- | existingLoadBalancerObj? | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | Existing Application Load Balancer to incorporate into the construct architecture. Providing both this and loadBalancerProps is an error. The VPC containing this loadBalancer must match the VPC provided in existingVpc. |
173
- | listenerProps? | [ApplicationListenerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListenerProps.html) | Props to define the listener. Must be provided when adding the listener to an ALB (eg - when creating the alb), may not be provided when adding a second target to an already established listener. When provided, must include either a certificate or protocol: HTTP |
174
- | targetProps? | [ApplicationTargetGroupProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroupProps.html) | Optional custom properties for a new target group. While this is a standard attribute of props for ALB constructs, there are few pertinent properties for a Lambda target. |
175
- | ruleProps? | [AddRuleProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.AddRuleProps.html) | Rules for directing traffic to the target being created. May not be specified for the first listener added to an ALB, and must be specified for the second target added to a listener. Add a second target by instantiating this construct a second time and providing the existingAlb from the first instantiation. |
176
- | vpcProps? | [ec2.VpcProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html) | Optional custom properties for a VPC the construct will create. This VPC will be used by the new ALB and any Private Hosted Zone the construct creates (that's why loadBalancerProps and privateHostedZoneProps can't include a VPC). Providing both this and existingVpc is an error. |
177
- |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.|
178
- |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.|
179
- | existingVpc? | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | An existing VPC in which to deploy the construct. Providing both this and vpcProps is an error. If the client provides an existing load balancer and/or existing Private Hosted Zone, those constructs must exist in this VPC. |
180
- | logAlbAccessLogs? | boolean| Whether to turn on Access Logs for the Application Load Balancer. Uses an S3 bucket with associated storage costs.Enabling Access Logging is a best practice. default - true |
181
- | albLoggingBucketProps? | [s3.BucketProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html) | Optional properties to customize the bucket used to store the ALB Access Logs. Supplying this and setting logAccessLogs to false is an error. @default - none |
182
- | publicApi | boolean | Whether the construct is deploying a private or public API. This has implications for the VPC and ALB. |
183
-
184
- ## Pattern Properties
185
-
186
- | **Name** | **Type** | **Description** |
187
- |:-------------|:----------------|-----------------|
188
- | vpc | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | The VPC used by the construct (whether created by the construct or providedb by the client) |
189
- | loadBalancer | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | The Load Balancer used by the construct (whether created by the construct or provided by the client) |
190
- |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 used in the pattern.|
191
- | listener | [`elb.ApplicationListener`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListener.html) | The listener used by this pattern. |
192
-
193
- ## Default settings
194
-
195
- Out of the box implementation of the Construct without any override will set the following defaults:
196
-
197
- ### Application Load Balancer
198
-
199
- * Creates or configures an Application Load Balancer with:
200
-
201
- * Required listeners
202
- * New target group with routing rules if appropriate
203
-
204
- ### AWS Lambda Function
205
-
206
- * Configure limited privilege access IAM role for Lambda function
207
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
208
- * Enable X-Ray Tracing
209
- * Set Environment Variables
210
-
211
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
212
-
213
- ## Architecture
214
-
215
- ![Architecture Diagram](architecture.png)
216
-
217
- ---
218
-
219
-
220
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,193 +0,0 @@
1
- # aws-alb-lambda module
2
-
3
- <!--BEGIN STABILITY BANNER-->---
4
-
5
-
6
- ![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
7
-
8
- > All classes are under active development and subject to non-backward compatible changes or removal in any
9
- > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.
10
- > This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
11
-
12
- ---
13
- <!--END STABILITY BANNER-->
14
-
15
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
16
- |:-------------|:-------------|
17
-
18
- <div style="height:8px"></div>
19
-
20
- | **Language** | **Package** |
21
- |:-------------|-----------------|
22
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_alb_lambda`|
23
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-alb-lambda`|
24
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.alblambda`|
25
-
26
- ## Overview
27
-
28
- This AWS Solutions Construct implements an an Application Load Balancer to an AWS Lambda function
29
-
30
- Here is a minimal deployable pattern definition:
31
-
32
- Typescript
33
-
34
- ```python
35
- import { Construct } from 'constructs';
36
- import { Stack, StackProps } from 'aws-cdk-lib';
37
- import { AlbToLambda, AlbToLambdaProps } from '@aws-solutions-constructs/aws-alb-lambda';
38
- import * as acm from 'aws-cdk-lib/aws-certificatemanager';
39
- import * as lambda from 'aws-cdk-lib/aws-lambda';
40
-
41
- // Obtain a pre-existing certificate from your account
42
- const certificate = acm.Certificate.fromCertificateArn(
43
- this,
44
- 'existing-cert',
45
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
46
- );
47
-
48
- const constructProps: AlbToLambdaProps = {
49
- lambdaFunctionProps: {
50
- code: lambda.Code.fromAsset(`lambda`),
51
- runtime: lambda.Runtime.NODEJS_20_X,
52
- handler: 'index.handler'
53
- },
54
- listenerProps: {
55
- certificates: [certificate]
56
- },
57
- publicApi: true
58
- };
59
-
60
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
61
- // and region be provided when creating the stack
62
- //
63
- // new MyStack(app, 'id', {env: {account: '123456789012', region: 'us-east-1' }});
64
- new AlbToLambda(this, 'new-construct', constructProps);
65
- ```
66
-
67
- Python
68
-
69
- ```python
70
- from aws_solutions_constructs.aws_alb_lambda import AlbToLambda, AlbToLambdaProps
71
- from aws_cdk import (
72
- aws_certificatemanager as acm,
73
- aws_lambda as _lambda,
74
- aws_elasticloadbalancingv2 as alb,
75
- Stack
76
- )
77
- from constructs import Construct
78
-
79
- # Obtain a pre-existing certificate from your account
80
- certificate = acm.Certificate.from_certificate_arn(
81
- self,
82
- 'existing-cert',
83
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
84
- )
85
-
86
- # Note - all alb constructs turn on ELB logging by default, so require that an environment including account
87
- # and region be provided when creating the stack
88
- #
89
- # MyStack(app, 'id', env=cdk.Environment(account='123456789012', region='us-east-1'))
90
- AlbToLambda(self, 'new-construct',
91
- lambda_function_props=_lambda.FunctionProps(
92
- runtime=_lambda.Runtime.PYTHON_3_11,
93
- code=_lambda.Code.from_asset('lambda'),
94
- handler='index.handler',
95
- ),
96
- listener_props=alb.BaseApplicationListenerProps(
97
- certificates=[certificate]
98
- ),
99
- public_api=True)
100
- ```
101
-
102
- Java
103
-
104
- ```java
105
- import software.constructs.Construct;
106
- import java.util.List;
107
-
108
- import software.amazon.awscdk.Stack;
109
- import software.amazon.awscdk.StackProps;
110
- import software.amazon.awscdk.services.elasticloadbalancingv2.*;
111
- import software.amazon.awscdk.services.lambda.*;
112
- import software.amazon.awscdk.services.lambda.Runtime;
113
- import software.amazon.awsconstructs.services.alblambda.*;
114
-
115
- // Obtain a pre-existing certificate from your account
116
- ListenerCertificate listenerCertificate = ListenerCertificate
117
- .fromArn("arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012");
118
-
119
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
120
- // and region be provided when creating the stack
121
- //
122
- // new MyStack(app, "id", StackProps.builder()
123
- // .env(Environment.builder()
124
- // .account("123456789012")
125
- // .region("us-east-1")
126
- // .build());
127
- new AlbToLambda(this, "AlbToLambdaPattern", new AlbToLambdaProps.Builder()
128
- .lambdaFunctionProps(new FunctionProps.Builder()
129
- .runtime(Runtime.NODEJS_20_X)
130
- .code(Code.fromAsset("lambda"))
131
- .handler("index.handler")
132
- .build())
133
- .listenerProps(new BaseApplicationListenerProps.Builder()
134
- .certificates(List.of(listenerCertificate))
135
- .build())
136
- .publicApi(true)
137
- .build());
138
- ```
139
-
140
- ## Pattern Construct Props
141
-
142
- | **Name** | **Type** | **Description** |
143
- |:-------------|:----------------|-----------------|
144
- | loadBalancerProps? | [elasticloadbalancingv2.ApplicationLoadBalancerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps.html) | Optional custom properties for a new loadBalancer. Providing both this and existingLoadBalancer is an error. This cannot specify a VPC, it will use the VPC in existingVpc or the VPC created by the construct. |
145
- | existingLoadBalancerObj? | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | Existing Application Load Balancer to incorporate into the construct architecture. Providing both this and loadBalancerProps is an error. The VPC containing this loadBalancer must match the VPC provided in existingVpc. |
146
- | listenerProps? | [ApplicationListenerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListenerProps.html) | Props to define the listener. Must be provided when adding the listener to an ALB (eg - when creating the alb), may not be provided when adding a second target to an already established listener. When provided, must include either a certificate or protocol: HTTP |
147
- | targetProps? | [ApplicationTargetGroupProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroupProps.html) | Optional custom properties for a new target group. While this is a standard attribute of props for ALB constructs, there are few pertinent properties for a Lambda target. |
148
- | ruleProps? | [AddRuleProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.AddRuleProps.html) | Rules for directing traffic to the target being created. May not be specified for the first listener added to an ALB, and must be specified for the second target added to a listener. Add a second target by instantiating this construct a second time and providing the existingAlb from the first instantiation. |
149
- | vpcProps? | [ec2.VpcProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html) | Optional custom properties for a VPC the construct will create. This VPC will be used by the new ALB and any Private Hosted Zone the construct creates (that's why loadBalancerProps and privateHostedZoneProps can't include a VPC). Providing both this and existingVpc is an error. |
150
- |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.|
151
- |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.|
152
- | existingVpc? | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | An existing VPC in which to deploy the construct. Providing both this and vpcProps is an error. If the client provides an existing load balancer and/or existing Private Hosted Zone, those constructs must exist in this VPC. |
153
- | logAlbAccessLogs? | boolean| Whether to turn on Access Logs for the Application Load Balancer. Uses an S3 bucket with associated storage costs.Enabling Access Logging is a best practice. default - true |
154
- | albLoggingBucketProps? | [s3.BucketProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html) | Optional properties to customize the bucket used to store the ALB Access Logs. Supplying this and setting logAccessLogs to false is an error. @default - none |
155
- | publicApi | boolean | Whether the construct is deploying a private or public API. This has implications for the VPC and ALB. |
156
-
157
- ## Pattern Properties
158
-
159
- | **Name** | **Type** | **Description** |
160
- |:-------------|:----------------|-----------------|
161
- | vpc | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | The VPC used by the construct (whether created by the construct or providedb by the client) |
162
- | loadBalancer | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | The Load Balancer used by the construct (whether created by the construct or provided by the client) |
163
- |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 used in the pattern.|
164
- | listener | [`elb.ApplicationListener`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListener.html) | The listener used by this pattern. |
165
-
166
- ## Default settings
167
-
168
- Out of the box implementation of the Construct without any override will set the following defaults:
169
-
170
- ### Application Load Balancer
171
-
172
- * Creates or configures an Application Load Balancer with:
173
-
174
- * Required listeners
175
- * New target group with routing rules if appropriate
176
-
177
- ### AWS Lambda Function
178
-
179
- * Configure limited privilege access IAM role for Lambda function
180
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
181
- * Enable X-Ray Tracing
182
- * Set Environment Variables
183
-
184
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
185
-
186
- ## Architecture
187
-
188
- ![Architecture Diagram](architecture.png)
189
-
190
- ---
191
-
192
-
193
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,220 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-alb-lambda
3
- Version: 2.85.2
4
- Summary: CDK Constructs for Application Load Balancer 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.core==2.85.2
23
- Requires-Dist: constructs<11.0.0,>=10.0.0
24
- Requires-Dist: jsii<2.0.0,>=1.111.0
25
- Requires-Dist: publication>=0.0.3
26
- Requires-Dist: typeguard<4.3.0,>=2.13.3
27
-
28
- # aws-alb-lambda module
29
-
30
- <!--BEGIN STABILITY BANNER-->---
31
-
32
-
33
- ![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
34
-
35
- > All classes are under active development and subject to non-backward compatible changes or removal in any
36
- > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.
37
- > This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
38
-
39
- ---
40
- <!--END STABILITY BANNER-->
41
-
42
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
43
- |:-------------|:-------------|
44
-
45
- <div style="height:8px"></div>
46
-
47
- | **Language** | **Package** |
48
- |:-------------|-----------------|
49
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_alb_lambda`|
50
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-alb-lambda`|
51
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.alblambda`|
52
-
53
- ## Overview
54
-
55
- This AWS Solutions Construct implements an an Application Load Balancer to an AWS Lambda function
56
-
57
- Here is a minimal deployable pattern definition:
58
-
59
- Typescript
60
-
61
- ```python
62
- import { Construct } from 'constructs';
63
- import { Stack, StackProps } from 'aws-cdk-lib';
64
- import { AlbToLambda, AlbToLambdaProps } from '@aws-solutions-constructs/aws-alb-lambda';
65
- import * as acm from 'aws-cdk-lib/aws-certificatemanager';
66
- import * as lambda from 'aws-cdk-lib/aws-lambda';
67
-
68
- // Obtain a pre-existing certificate from your account
69
- const certificate = acm.Certificate.fromCertificateArn(
70
- this,
71
- 'existing-cert',
72
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
73
- );
74
-
75
- const constructProps: AlbToLambdaProps = {
76
- lambdaFunctionProps: {
77
- code: lambda.Code.fromAsset(`lambda`),
78
- runtime: lambda.Runtime.NODEJS_20_X,
79
- handler: 'index.handler'
80
- },
81
- listenerProps: {
82
- certificates: [certificate]
83
- },
84
- publicApi: true
85
- };
86
-
87
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
88
- // and region be provided when creating the stack
89
- //
90
- // new MyStack(app, 'id', {env: {account: '123456789012', region: 'us-east-1' }});
91
- new AlbToLambda(this, 'new-construct', constructProps);
92
- ```
93
-
94
- Python
95
-
96
- ```python
97
- from aws_solutions_constructs.aws_alb_lambda import AlbToLambda, AlbToLambdaProps
98
- from aws_cdk import (
99
- aws_certificatemanager as acm,
100
- aws_lambda as _lambda,
101
- aws_elasticloadbalancingv2 as alb,
102
- Stack
103
- )
104
- from constructs import Construct
105
-
106
- # Obtain a pre-existing certificate from your account
107
- certificate = acm.Certificate.from_certificate_arn(
108
- self,
109
- 'existing-cert',
110
- "arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012"
111
- )
112
-
113
- # Note - all alb constructs turn on ELB logging by default, so require that an environment including account
114
- # and region be provided when creating the stack
115
- #
116
- # MyStack(app, 'id', env=cdk.Environment(account='123456789012', region='us-east-1'))
117
- AlbToLambda(self, 'new-construct',
118
- lambda_function_props=_lambda.FunctionProps(
119
- runtime=_lambda.Runtime.PYTHON_3_11,
120
- code=_lambda.Code.from_asset('lambda'),
121
- handler='index.handler',
122
- ),
123
- listener_props=alb.BaseApplicationListenerProps(
124
- certificates=[certificate]
125
- ),
126
- public_api=True)
127
- ```
128
-
129
- Java
130
-
131
- ```java
132
- import software.constructs.Construct;
133
- import java.util.List;
134
-
135
- import software.amazon.awscdk.Stack;
136
- import software.amazon.awscdk.StackProps;
137
- import software.amazon.awscdk.services.elasticloadbalancingv2.*;
138
- import software.amazon.awscdk.services.lambda.*;
139
- import software.amazon.awscdk.services.lambda.Runtime;
140
- import software.amazon.awsconstructs.services.alblambda.*;
141
-
142
- // Obtain a pre-existing certificate from your account
143
- ListenerCertificate listenerCertificate = ListenerCertificate
144
- .fromArn("arn:aws:acm:us-east-1:123456789012:certificate/11112222-3333-1234-1234-123456789012");
145
-
146
- // Note - all alb constructs turn on ELB logging by default, so require that an environment including account
147
- // and region be provided when creating the stack
148
- //
149
- // new MyStack(app, "id", StackProps.builder()
150
- // .env(Environment.builder()
151
- // .account("123456789012")
152
- // .region("us-east-1")
153
- // .build());
154
- new AlbToLambda(this, "AlbToLambdaPattern", new AlbToLambdaProps.Builder()
155
- .lambdaFunctionProps(new FunctionProps.Builder()
156
- .runtime(Runtime.NODEJS_20_X)
157
- .code(Code.fromAsset("lambda"))
158
- .handler("index.handler")
159
- .build())
160
- .listenerProps(new BaseApplicationListenerProps.Builder()
161
- .certificates(List.of(listenerCertificate))
162
- .build())
163
- .publicApi(true)
164
- .build());
165
- ```
166
-
167
- ## Pattern Construct Props
168
-
169
- | **Name** | **Type** | **Description** |
170
- |:-------------|:----------------|-----------------|
171
- | loadBalancerProps? | [elasticloadbalancingv2.ApplicationLoadBalancerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancerProps.html) | Optional custom properties for a new loadBalancer. Providing both this and existingLoadBalancer is an error. This cannot specify a VPC, it will use the VPC in existingVpc or the VPC created by the construct. |
172
- | existingLoadBalancerObj? | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | Existing Application Load Balancer to incorporate into the construct architecture. Providing both this and loadBalancerProps is an error. The VPC containing this loadBalancer must match the VPC provided in existingVpc. |
173
- | listenerProps? | [ApplicationListenerProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListenerProps.html) | Props to define the listener. Must be provided when adding the listener to an ALB (eg - when creating the alb), may not be provided when adding a second target to an already established listener. When provided, must include either a certificate or protocol: HTTP |
174
- | targetProps? | [ApplicationTargetGroupProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroupProps.html) | Optional custom properties for a new target group. While this is a standard attribute of props for ALB constructs, there are few pertinent properties for a Lambda target. |
175
- | ruleProps? | [AddRuleProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.AddRuleProps.html) | Rules for directing traffic to the target being created. May not be specified for the first listener added to an ALB, and must be specified for the second target added to a listener. Add a second target by instantiating this construct a second time and providing the existingAlb from the first instantiation. |
176
- | vpcProps? | [ec2.VpcProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html) | Optional custom properties for a VPC the construct will create. This VPC will be used by the new ALB and any Private Hosted Zone the construct creates (that's why loadBalancerProps and privateHostedZoneProps can't include a VPC). Providing both this and existingVpc is an error. |
177
- |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.|
178
- |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.|
179
- | existingVpc? | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | An existing VPC in which to deploy the construct. Providing both this and vpcProps is an error. If the client provides an existing load balancer and/or existing Private Hosted Zone, those constructs must exist in this VPC. |
180
- | logAlbAccessLogs? | boolean| Whether to turn on Access Logs for the Application Load Balancer. Uses an S3 bucket with associated storage costs.Enabling Access Logging is a best practice. default - true |
181
- | albLoggingBucketProps? | [s3.BucketProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html) | Optional properties to customize the bucket used to store the ALB Access Logs. Supplying this and setting logAccessLogs to false is an error. @default - none |
182
- | publicApi | boolean | Whether the construct is deploying a private or public API. This has implications for the VPC and ALB. |
183
-
184
- ## Pattern Properties
185
-
186
- | **Name** | **Type** | **Description** |
187
- |:-------------|:----------------|-----------------|
188
- | vpc | [ec2.IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | The VPC used by the construct (whether created by the construct or providedb by the client) |
189
- | loadBalancer | [elasticloadbalancingv2.ApplicationLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) | The Load Balancer used by the construct (whether created by the construct or provided by the client) |
190
- |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 used in the pattern.|
191
- | listener | [`elb.ApplicationListener`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListener.html) | The listener used by this pattern. |
192
-
193
- ## Default settings
194
-
195
- Out of the box implementation of the Construct without any override will set the following defaults:
196
-
197
- ### Application Load Balancer
198
-
199
- * Creates or configures an Application Load Balancer with:
200
-
201
- * Required listeners
202
- * New target group with routing rules if appropriate
203
-
204
- ### AWS Lambda Function
205
-
206
- * Configure limited privilege access IAM role for Lambda function
207
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
208
- * Enable X-Ray Tracing
209
- * Set Environment Variables
210
-
211
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
212
-
213
- ## Architecture
214
-
215
- ![Architecture Diagram](architecture.png)
216
-
217
- ---
218
-
219
-
220
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.