aws-solutions-constructs.aws-lambda-sagemakerendpoint 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_lambda_sagemakerendpoint-2.85.3/PKG-INFO +28 -0
  2. aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3/README.md +1 -0
  3. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/setup.py +3 -3
  4. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/__init__.py +1 -176
  5. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/_jsii/__init__.py +2 -2
  6. aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3/src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/_jsii/aws-lambda-sagemakerendpoint@2.85.3.jsii.tgz +0 -0
  7. aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3/src/aws_solutions_constructs.aws_lambda_sagemakerendpoint.egg-info/PKG-INFO +28 -0
  8. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/src/aws_solutions_constructs.aws_lambda_sagemakerendpoint.egg-info/SOURCES.txt +1 -1
  9. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/src/aws_solutions_constructs.aws_lambda_sagemakerendpoint.egg-info/requires.txt +1 -1
  10. aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2/PKG-INFO +0 -203
  11. aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2/README.md +0 -176
  12. aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2/src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/_jsii/aws-lambda-sagemakerendpoint@2.85.2.jsii.tgz +0 -0
  13. aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2/src/aws_solutions_constructs.aws_lambda_sagemakerendpoint.egg-info/PKG-INFO +0 -203
  14. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/LICENSE +0 -0
  15. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/MANIFEST.in +0 -0
  16. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/pyproject.toml +0 -0
  17. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/setup.cfg +0 -0
  18. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/py.typed +0 -0
  19. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/src/aws_solutions_constructs.aws_lambda_sagemakerendpoint.egg-info/dependency_links.txt +0 -0
  20. {aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.2 → aws_solutions_constructs_aws_lambda_sagemakerendpoint-2.85.3}/src/aws_solutions_constructs.aws_lambda_sagemakerendpoint.egg-info/top_level.txt +0 -0
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-lambda-sagemakerendpoint
3
+ Version: 2.85.3
4
+ Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SageMaker inference endpoint.
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.3
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-lambda-sagemakerendpoint/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-lambda-sagemakerendpoint/README.adoc)
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "aws-solutions-constructs.aws-lambda-sagemakerendpoint",
8
- "version": "2.85.2",
8
+ "version": "2.85.3",
9
9
  "description": "CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SageMaker inference endpoint.",
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_lambda_sagemakerendpoint._jsii": [
29
- "aws-lambda-sagemakerendpoint@2.85.2.jsii.tgz"
29
+ "aws-lambda-sagemakerendpoint@2.85.3.jsii.tgz"
30
30
  ],
31
31
  "aws_solutions_constructs.aws_lambda_sagemakerendpoint": [
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.3",
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,180 +1,5 @@
1
1
  r'''
2
- # aws-lambda-sagemakerendpoint 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_lambda_sagemakerendpoint` |
24
- | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-sagemakerendpoint` |
25
- | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdasagemakerendpoint` |
26
-
27
- ## Overview
28
-
29
- This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon Sagemaker Endpoint.
30
-
31
- Here is a minimal deployable pattern definition:
32
-
33
- Typescript
34
-
35
- ```python
36
- import { Construct } from 'constructs';
37
- import { Stack, StackProps, Duration } from 'aws-cdk-lib';
38
- import * as lambda from 'aws-cdk-lib/aws-lambda';
39
- import { LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps } from '@aws-solutions-constructs/aws-lambda-sagemakerendpoint';
40
-
41
- const constructProps: LambdaToSagemakerEndpointProps = {
42
- modelProps: {
43
- primaryContainer: {
44
- image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
45
- modelDataUrl: "s3://<bucket-name>/<prefix>/model.tar.gz",
46
- },
47
- },
48
- lambdaFunctionProps: {
49
- runtime: lambda.Runtime.PYTHON_3_8,
50
- code: lambda.Code.fromAsset(`lambda`),
51
- handler: 'index.handler',
52
- timeout: Duration.minutes(5),
53
- memorySize: 128,
54
- },
55
- };
56
-
57
- new LambdaToSagemakerEndpoint(this, 'LambdaToSagemakerEndpointPattern', constructProps);
58
- ```
59
-
60
- Python
61
-
62
- ```python
63
- from constructs import Construct
64
- from aws_solutions_constructs.aws_lambda_sagemakerendpoint import LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps
65
- from aws_cdk import (
66
- aws_lambda as _lambda,
67
- aws_sagemaker as sagemaker,
68
- Duration,
69
- Stack
70
- )
71
- from constructs import Construct
72
-
73
- LambdaToSagemakerEndpoint(
74
- self, 'LambdaToSagemakerEndpointPattern',
75
- model_props=sagemaker.CfnModelProps(
76
- primary_container=sagemaker.CfnModel.ContainerDefinitionProperty(
77
- image='<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
78
- model_data_url='s3://<bucket-name>/<prefix>/model.tar.gz',
79
- ),
80
- execution_role_arn="executionRoleArn"
81
- ),
82
- lambda_function_props=_lambda.FunctionProps(
83
- code=_lambda.Code.from_asset('lambda'),
84
- runtime=_lambda.Runtime.PYTHON_3_11,
85
- handler='index.handler',
86
- timeout=Duration.minutes(5),
87
- memory_size=128
88
- ))
89
- ```
90
-
91
- Java
92
-
93
- ```java
94
- import software.constructs.Construct;
95
-
96
- import software.amazon.awscdk.Stack;
97
- import software.amazon.awscdk.StackProps;
98
- import software.amazon.awscdk.Duration;
99
- import software.amazon.awscdk.services.lambda.*;
100
- import software.amazon.awscdk.services.lambda.Runtime;
101
- import software.amazon.awscdk.services.sagemaker.*;
102
- import software.amazon.awsconstructs.services.lambdasagemakerendpoint.*;
103
-
104
- new LambdaToSagemakerEndpoint(this, "LambdaToSagemakerEndpointPattern",
105
- new LambdaToSagemakerEndpointProps.Builder()
106
- .modelProps(new CfnModelProps.Builder()
107
- .primaryContainer(new CfnModel.ContainerDefinitionProperty.Builder()
108
- .image("<AccountId>.dkr.ecr.<region>.amazonaws.com/linear_learner:latest")
109
- .modelDataUrl("s3://<bucket_name>/<prefix>/model.tar.gz")
110
- .build())
111
- .executionRoleArn("executionRoleArn")
112
- .build())
113
- .lambdaFunctionProps(new FunctionProps.Builder()
114
- .runtime(Runtime.NODEJS_20_X)
115
- .code(Code.fromAsset("lambda"))
116
- .handler("index.handler")
117
- .timeout(Duration.minutes(5))
118
- .build())
119
- .build());
120
- ```
121
-
122
- ## Pattern Construct Props
123
-
124
- | **Name** | **Type** | **Description** |
125
- |:-------------|:----------------|-----------------|
126
- |existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|An optional, existing Lambda function to be used instead of the default function. Providing both this and `lambdaFunctionProps` will cause an error.|
127
- |lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|Optional user-provided properties to override the default properties for the Lambda function.|
128
- |existingSagemakerEndpointObj?|[`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html)|An optional, existing SageMaker Endpoint to be used. Providing both this and `endpointProps?` will cause an error.|
129
- |modelProps?|[`sagemaker.CfnModelProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModelProps.html) | `any`|User-provided properties to override the default properties for the SageMaker Model. At least `modelProps?.primaryContainer` must be provided to create a model. By default, the pattern will create a role with the minimum required permissions, but the client can provide a custom role with additional capabilities using `modelProps?.executionRoleArn`.|
130
- |endpointConfigProps?|[`sagemaker.CfnEndpointConfigProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfigProps.html)|Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
131
- |endpointProps?|[`sagemaker.CfnEndpointProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointProps.html)| Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
132
- |existingVpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html)|An optional, existing VPC into which this construct should be deployed. When deployed in a VPC, the Lambda function and Sagemaker Endpoint will use ENIs in the VPC to access network resources. An Interface Endpoint will be created in the VPC for Amazon SageMaker Runtime, and Amazon S3 VPC Endpoint. If an existing VPC is provided, the `deployVpc?` property cannot be `true`.|
133
- |vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html)|Optional user-provided properties to override the default properties for the new VPC. `enableDnsHostnames`, `enableDnsSupport`, `natGateways` and `subnetConfiguration` are set by the Construct, so any values for those properties supplied here will be overridden. If `deployVpc?` is not `true` then this property will be ignored.|
134
- |deployVpc?|`boolean`|Whether to create a new VPC based on `vpcProps` into which to deploy this pattern. Setting this to true will deploy the minimal, most private VPC to run the pattern:<ul><li> One isolated subnet in each Availability Zone used by the CDK program</li><li>`enableDnsHostnames` and `enableDnsSupport` will both be set to true</li></ul>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`.|
135
- |sagemakerEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the SageMaker endpoint. Default: SAGEMAKER_ENDPOINT_NAME |
136
-
137
- ## Pattern Properties
138
-
139
- | **Name** | **Type** | **Description** |
140
- | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
141
- | 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. |
142
- | sagemakerEndpoint | [`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html) | Returns an instance of the SageMaker Endpoint created by the pattern. |
143
- | sagemakerEndpointConfig? | [`sagemaker.CfnEndpointConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfig.html) | Returns an instance of the SageMaker EndpointConfig created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
144
- | sagemakerModel? | [`sagemaker.CfnModel`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModel.html) | Returns an instance of the SageMaker Model created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
145
- | vpc? | `ec2.IVpc` | Returns an instance of the VPC created by the pattern, if `deployVpc?` is `true`, or `existingVpc?` is provided. |
146
-
147
- ## Default settings
148
-
149
- Out of the box implementation of the Construct without any override will set the following defaults:
150
-
151
- ### AWS Lambda Function
152
-
153
- * Configure limited privilege access IAM role for Lambda function
154
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
155
- * Allow the function to invoke the SageMaker endpoint for Inferences
156
- * Configure the function to access resources in the VPC, where the SageMaker endpoint is deployed
157
- * Enable X-Ray Tracing
158
- * Set environment variables:
159
-
160
- * (default) SAGEMAKER_ENDPOINT_NAME
161
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions).
162
-
163
- ### Amazon SageMaker Endpoint
164
-
165
- * Configure limited privilege to create SageMaker resources
166
- * Deploy SageMaker model, endpointConfig, and endpoint
167
- * Configure the SageMaker endpoint to be deployed in a VPC
168
- * Deploy S3 VPC Endpoint and SageMaker Runtime VPC Interface
169
-
170
- ## Architecture
171
-
172
- ![Architecture Diagram](architecture.png)
173
-
174
- ---
175
-
176
-
177
- © 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-lambda-sagemakerendpoint/README.adoc)
178
3
  '''
179
4
  from pkgutil import extend_path
180
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-lambda-sagemakerendpoint",
37
- "2.85.2",
37
+ "2.85.3",
38
38
  __name__[0:-6],
39
- "aws-lambda-sagemakerendpoint@2.85.2.jsii.tgz",
39
+ "aws-lambda-sagemakerendpoint@2.85.3.jsii.tgz",
40
40
  )
41
41
 
42
42
  __all__ = [
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-lambda-sagemakerendpoint
3
+ Version: 2.85.3
4
+ Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SageMaker inference endpoint.
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.3
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-lambda-sagemakerendpoint/README.adoc)
@@ -11,4 +11,4 @@ src/aws_solutions_constructs.aws_lambda_sagemakerendpoint.egg-info/top_level.txt
11
11
  src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/__init__.py
12
12
  src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/py.typed
13
13
  src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/_jsii/__init__.py
14
- src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/_jsii/aws-lambda-sagemakerendpoint@2.85.2.jsii.tgz
14
+ src/aws_solutions_constructs/aws_lambda_sagemakerendpoint/_jsii/aws-lambda-sagemakerendpoint@2.85.3.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.3
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,203 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-lambda-sagemakerendpoint
3
- Version: 2.85.2
4
- Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SageMaker inference endpoint.
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-lambda-sagemakerendpoint 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_lambda_sagemakerendpoint` |
50
- | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-sagemakerendpoint` |
51
- | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdasagemakerendpoint` |
52
-
53
- ## Overview
54
-
55
- This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon Sagemaker Endpoint.
56
-
57
- Here is a minimal deployable pattern definition:
58
-
59
- Typescript
60
-
61
- ```python
62
- import { Construct } from 'constructs';
63
- import { Stack, StackProps, Duration } from 'aws-cdk-lib';
64
- import * as lambda from 'aws-cdk-lib/aws-lambda';
65
- import { LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps } from '@aws-solutions-constructs/aws-lambda-sagemakerendpoint';
66
-
67
- const constructProps: LambdaToSagemakerEndpointProps = {
68
- modelProps: {
69
- primaryContainer: {
70
- image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
71
- modelDataUrl: "s3://<bucket-name>/<prefix>/model.tar.gz",
72
- },
73
- },
74
- lambdaFunctionProps: {
75
- runtime: lambda.Runtime.PYTHON_3_8,
76
- code: lambda.Code.fromAsset(`lambda`),
77
- handler: 'index.handler',
78
- timeout: Duration.minutes(5),
79
- memorySize: 128,
80
- },
81
- };
82
-
83
- new LambdaToSagemakerEndpoint(this, 'LambdaToSagemakerEndpointPattern', constructProps);
84
- ```
85
-
86
- Python
87
-
88
- ```python
89
- from constructs import Construct
90
- from aws_solutions_constructs.aws_lambda_sagemakerendpoint import LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps
91
- from aws_cdk import (
92
- aws_lambda as _lambda,
93
- aws_sagemaker as sagemaker,
94
- Duration,
95
- Stack
96
- )
97
- from constructs import Construct
98
-
99
- LambdaToSagemakerEndpoint(
100
- self, 'LambdaToSagemakerEndpointPattern',
101
- model_props=sagemaker.CfnModelProps(
102
- primary_container=sagemaker.CfnModel.ContainerDefinitionProperty(
103
- image='<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
104
- model_data_url='s3://<bucket-name>/<prefix>/model.tar.gz',
105
- ),
106
- execution_role_arn="executionRoleArn"
107
- ),
108
- lambda_function_props=_lambda.FunctionProps(
109
- code=_lambda.Code.from_asset('lambda'),
110
- runtime=_lambda.Runtime.PYTHON_3_11,
111
- handler='index.handler',
112
- timeout=Duration.minutes(5),
113
- memory_size=128
114
- ))
115
- ```
116
-
117
- Java
118
-
119
- ```java
120
- import software.constructs.Construct;
121
-
122
- import software.amazon.awscdk.Stack;
123
- import software.amazon.awscdk.StackProps;
124
- import software.amazon.awscdk.Duration;
125
- import software.amazon.awscdk.services.lambda.*;
126
- import software.amazon.awscdk.services.lambda.Runtime;
127
- import software.amazon.awscdk.services.sagemaker.*;
128
- import software.amazon.awsconstructs.services.lambdasagemakerendpoint.*;
129
-
130
- new LambdaToSagemakerEndpoint(this, "LambdaToSagemakerEndpointPattern",
131
- new LambdaToSagemakerEndpointProps.Builder()
132
- .modelProps(new CfnModelProps.Builder()
133
- .primaryContainer(new CfnModel.ContainerDefinitionProperty.Builder()
134
- .image("<AccountId>.dkr.ecr.<region>.amazonaws.com/linear_learner:latest")
135
- .modelDataUrl("s3://<bucket_name>/<prefix>/model.tar.gz")
136
- .build())
137
- .executionRoleArn("executionRoleArn")
138
- .build())
139
- .lambdaFunctionProps(new FunctionProps.Builder()
140
- .runtime(Runtime.NODEJS_20_X)
141
- .code(Code.fromAsset("lambda"))
142
- .handler("index.handler")
143
- .timeout(Duration.minutes(5))
144
- .build())
145
- .build());
146
- ```
147
-
148
- ## Pattern Construct Props
149
-
150
- | **Name** | **Type** | **Description** |
151
- |:-------------|:----------------|-----------------|
152
- |existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|An optional, existing Lambda function to be used instead of the default function. Providing both this and `lambdaFunctionProps` will cause an error.|
153
- |lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|Optional user-provided properties to override the default properties for the Lambda function.|
154
- |existingSagemakerEndpointObj?|[`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html)|An optional, existing SageMaker Endpoint to be used. Providing both this and `endpointProps?` will cause an error.|
155
- |modelProps?|[`sagemaker.CfnModelProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModelProps.html) | `any`|User-provided properties to override the default properties for the SageMaker Model. At least `modelProps?.primaryContainer` must be provided to create a model. By default, the pattern will create a role with the minimum required permissions, but the client can provide a custom role with additional capabilities using `modelProps?.executionRoleArn`.|
156
- |endpointConfigProps?|[`sagemaker.CfnEndpointConfigProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfigProps.html)|Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
157
- |endpointProps?|[`sagemaker.CfnEndpointProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointProps.html)| Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
158
- |existingVpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html)|An optional, existing VPC into which this construct should be deployed. When deployed in a VPC, the Lambda function and Sagemaker Endpoint will use ENIs in the VPC to access network resources. An Interface Endpoint will be created in the VPC for Amazon SageMaker Runtime, and Amazon S3 VPC Endpoint. If an existing VPC is provided, the `deployVpc?` property cannot be `true`.|
159
- |vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html)|Optional user-provided properties to override the default properties for the new VPC. `enableDnsHostnames`, `enableDnsSupport`, `natGateways` and `subnetConfiguration` are set by the Construct, so any values for those properties supplied here will be overridden. If `deployVpc?` is not `true` then this property will be ignored.|
160
- |deployVpc?|`boolean`|Whether to create a new VPC based on `vpcProps` into which to deploy this pattern. Setting this to true will deploy the minimal, most private VPC to run the pattern:<ul><li> One isolated subnet in each Availability Zone used by the CDK program</li><li>`enableDnsHostnames` and `enableDnsSupport` will both be set to true</li></ul>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`.|
161
- |sagemakerEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the SageMaker endpoint. Default: SAGEMAKER_ENDPOINT_NAME |
162
-
163
- ## Pattern Properties
164
-
165
- | **Name** | **Type** | **Description** |
166
- | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
167
- | 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. |
168
- | sagemakerEndpoint | [`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html) | Returns an instance of the SageMaker Endpoint created by the pattern. |
169
- | sagemakerEndpointConfig? | [`sagemaker.CfnEndpointConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfig.html) | Returns an instance of the SageMaker EndpointConfig created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
170
- | sagemakerModel? | [`sagemaker.CfnModel`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModel.html) | Returns an instance of the SageMaker Model created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
171
- | vpc? | `ec2.IVpc` | Returns an instance of the VPC created by the pattern, if `deployVpc?` is `true`, or `existingVpc?` is provided. |
172
-
173
- ## Default settings
174
-
175
- Out of the box implementation of the Construct without any override will set the following defaults:
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
- * Allow the function to invoke the SageMaker endpoint for Inferences
182
- * Configure the function to access resources in the VPC, where the SageMaker endpoint is deployed
183
- * Enable X-Ray Tracing
184
- * Set environment variables:
185
-
186
- * (default) SAGEMAKER_ENDPOINT_NAME
187
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions).
188
-
189
- ### Amazon SageMaker Endpoint
190
-
191
- * Configure limited privilege to create SageMaker resources
192
- * Deploy SageMaker model, endpointConfig, and endpoint
193
- * Configure the SageMaker endpoint to be deployed in a VPC
194
- * Deploy S3 VPC Endpoint and SageMaker Runtime VPC Interface
195
-
196
- ## Architecture
197
-
198
- ![Architecture Diagram](architecture.png)
199
-
200
- ---
201
-
202
-
203
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,176 +0,0 @@
1
- # aws-lambda-sagemakerendpoint 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_lambda_sagemakerendpoint` |
23
- | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-sagemakerendpoint` |
24
- | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdasagemakerendpoint` |
25
-
26
- ## Overview
27
-
28
- This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon Sagemaker Endpoint.
29
-
30
- Here is a minimal deployable pattern definition:
31
-
32
- Typescript
33
-
34
- ```python
35
- import { Construct } from 'constructs';
36
- import { Stack, StackProps, Duration } from 'aws-cdk-lib';
37
- import * as lambda from 'aws-cdk-lib/aws-lambda';
38
- import { LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps } from '@aws-solutions-constructs/aws-lambda-sagemakerendpoint';
39
-
40
- const constructProps: LambdaToSagemakerEndpointProps = {
41
- modelProps: {
42
- primaryContainer: {
43
- image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
44
- modelDataUrl: "s3://<bucket-name>/<prefix>/model.tar.gz",
45
- },
46
- },
47
- lambdaFunctionProps: {
48
- runtime: lambda.Runtime.PYTHON_3_8,
49
- code: lambda.Code.fromAsset(`lambda`),
50
- handler: 'index.handler',
51
- timeout: Duration.minutes(5),
52
- memorySize: 128,
53
- },
54
- };
55
-
56
- new LambdaToSagemakerEndpoint(this, 'LambdaToSagemakerEndpointPattern', constructProps);
57
- ```
58
-
59
- Python
60
-
61
- ```python
62
- from constructs import Construct
63
- from aws_solutions_constructs.aws_lambda_sagemakerendpoint import LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps
64
- from aws_cdk import (
65
- aws_lambda as _lambda,
66
- aws_sagemaker as sagemaker,
67
- Duration,
68
- Stack
69
- )
70
- from constructs import Construct
71
-
72
- LambdaToSagemakerEndpoint(
73
- self, 'LambdaToSagemakerEndpointPattern',
74
- model_props=sagemaker.CfnModelProps(
75
- primary_container=sagemaker.CfnModel.ContainerDefinitionProperty(
76
- image='<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
77
- model_data_url='s3://<bucket-name>/<prefix>/model.tar.gz',
78
- ),
79
- execution_role_arn="executionRoleArn"
80
- ),
81
- lambda_function_props=_lambda.FunctionProps(
82
- code=_lambda.Code.from_asset('lambda'),
83
- runtime=_lambda.Runtime.PYTHON_3_11,
84
- handler='index.handler',
85
- timeout=Duration.minutes(5),
86
- memory_size=128
87
- ))
88
- ```
89
-
90
- Java
91
-
92
- ```java
93
- import software.constructs.Construct;
94
-
95
- import software.amazon.awscdk.Stack;
96
- import software.amazon.awscdk.StackProps;
97
- import software.amazon.awscdk.Duration;
98
- import software.amazon.awscdk.services.lambda.*;
99
- import software.amazon.awscdk.services.lambda.Runtime;
100
- import software.amazon.awscdk.services.sagemaker.*;
101
- import software.amazon.awsconstructs.services.lambdasagemakerendpoint.*;
102
-
103
- new LambdaToSagemakerEndpoint(this, "LambdaToSagemakerEndpointPattern",
104
- new LambdaToSagemakerEndpointProps.Builder()
105
- .modelProps(new CfnModelProps.Builder()
106
- .primaryContainer(new CfnModel.ContainerDefinitionProperty.Builder()
107
- .image("<AccountId>.dkr.ecr.<region>.amazonaws.com/linear_learner:latest")
108
- .modelDataUrl("s3://<bucket_name>/<prefix>/model.tar.gz")
109
- .build())
110
- .executionRoleArn("executionRoleArn")
111
- .build())
112
- .lambdaFunctionProps(new FunctionProps.Builder()
113
- .runtime(Runtime.NODEJS_20_X)
114
- .code(Code.fromAsset("lambda"))
115
- .handler("index.handler")
116
- .timeout(Duration.minutes(5))
117
- .build())
118
- .build());
119
- ```
120
-
121
- ## Pattern Construct Props
122
-
123
- | **Name** | **Type** | **Description** |
124
- |:-------------|:----------------|-----------------|
125
- |existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|An optional, existing Lambda function to be used instead of the default function. Providing both this and `lambdaFunctionProps` will cause an error.|
126
- |lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|Optional user-provided properties to override the default properties for the Lambda function.|
127
- |existingSagemakerEndpointObj?|[`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html)|An optional, existing SageMaker Endpoint to be used. Providing both this and `endpointProps?` will cause an error.|
128
- |modelProps?|[`sagemaker.CfnModelProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModelProps.html) | `any`|User-provided properties to override the default properties for the SageMaker Model. At least `modelProps?.primaryContainer` must be provided to create a model. By default, the pattern will create a role with the minimum required permissions, but the client can provide a custom role with additional capabilities using `modelProps?.executionRoleArn`.|
129
- |endpointConfigProps?|[`sagemaker.CfnEndpointConfigProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfigProps.html)|Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
130
- |endpointProps?|[`sagemaker.CfnEndpointProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointProps.html)| Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
131
- |existingVpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html)|An optional, existing VPC into which this construct should be deployed. When deployed in a VPC, the Lambda function and Sagemaker Endpoint will use ENIs in the VPC to access network resources. An Interface Endpoint will be created in the VPC for Amazon SageMaker Runtime, and Amazon S3 VPC Endpoint. If an existing VPC is provided, the `deployVpc?` property cannot be `true`.|
132
- |vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html)|Optional user-provided properties to override the default properties for the new VPC. `enableDnsHostnames`, `enableDnsSupport`, `natGateways` and `subnetConfiguration` are set by the Construct, so any values for those properties supplied here will be overridden. If `deployVpc?` is not `true` then this property will be ignored.|
133
- |deployVpc?|`boolean`|Whether to create a new VPC based on `vpcProps` into which to deploy this pattern. Setting this to true will deploy the minimal, most private VPC to run the pattern:<ul><li> One isolated subnet in each Availability Zone used by the CDK program</li><li>`enableDnsHostnames` and `enableDnsSupport` will both be set to true</li></ul>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`.|
134
- |sagemakerEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the SageMaker endpoint. Default: SAGEMAKER_ENDPOINT_NAME |
135
-
136
- ## Pattern Properties
137
-
138
- | **Name** | **Type** | **Description** |
139
- | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
140
- | 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. |
141
- | sagemakerEndpoint | [`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html) | Returns an instance of the SageMaker Endpoint created by the pattern. |
142
- | sagemakerEndpointConfig? | [`sagemaker.CfnEndpointConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfig.html) | Returns an instance of the SageMaker EndpointConfig created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
143
- | sagemakerModel? | [`sagemaker.CfnModel`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModel.html) | Returns an instance of the SageMaker Model created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
144
- | vpc? | `ec2.IVpc` | Returns an instance of the VPC created by the pattern, if `deployVpc?` is `true`, or `existingVpc?` is provided. |
145
-
146
- ## Default settings
147
-
148
- Out of the box implementation of the Construct without any override will set the following defaults:
149
-
150
- ### AWS Lambda Function
151
-
152
- * Configure limited privilege access IAM role for Lambda function
153
- * Enable reusing connections with Keep-Alive for NodeJs Lambda function
154
- * Allow the function to invoke the SageMaker endpoint for Inferences
155
- * Configure the function to access resources in the VPC, where the SageMaker endpoint is deployed
156
- * Enable X-Ray Tracing
157
- * Set environment variables:
158
-
159
- * (default) SAGEMAKER_ENDPOINT_NAME
160
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions).
161
-
162
- ### Amazon SageMaker Endpoint
163
-
164
- * Configure limited privilege to create SageMaker resources
165
- * Deploy SageMaker model, endpointConfig, and endpoint
166
- * Configure the SageMaker endpoint to be deployed in a VPC
167
- * Deploy S3 VPC Endpoint and SageMaker Runtime VPC Interface
168
-
169
- ## Architecture
170
-
171
- ![Architecture Diagram](architecture.png)
172
-
173
- ---
174
-
175
-
176
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,203 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-lambda-sagemakerendpoint
3
- Version: 2.85.2
4
- Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SageMaker inference endpoint.
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-lambda-sagemakerendpoint 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_lambda_sagemakerendpoint` |
50
- | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-sagemakerendpoint` |
51
- | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdasagemakerendpoint` |
52
-
53
- ## Overview
54
-
55
- This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon Sagemaker Endpoint.
56
-
57
- Here is a minimal deployable pattern definition:
58
-
59
- Typescript
60
-
61
- ```python
62
- import { Construct } from 'constructs';
63
- import { Stack, StackProps, Duration } from 'aws-cdk-lib';
64
- import * as lambda from 'aws-cdk-lib/aws-lambda';
65
- import { LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps } from '@aws-solutions-constructs/aws-lambda-sagemakerendpoint';
66
-
67
- const constructProps: LambdaToSagemakerEndpointProps = {
68
- modelProps: {
69
- primaryContainer: {
70
- image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
71
- modelDataUrl: "s3://<bucket-name>/<prefix>/model.tar.gz",
72
- },
73
- },
74
- lambdaFunctionProps: {
75
- runtime: lambda.Runtime.PYTHON_3_8,
76
- code: lambda.Code.fromAsset(`lambda`),
77
- handler: 'index.handler',
78
- timeout: Duration.minutes(5),
79
- memorySize: 128,
80
- },
81
- };
82
-
83
- new LambdaToSagemakerEndpoint(this, 'LambdaToSagemakerEndpointPattern', constructProps);
84
- ```
85
-
86
- Python
87
-
88
- ```python
89
- from constructs import Construct
90
- from aws_solutions_constructs.aws_lambda_sagemakerendpoint import LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps
91
- from aws_cdk import (
92
- aws_lambda as _lambda,
93
- aws_sagemaker as sagemaker,
94
- Duration,
95
- Stack
96
- )
97
- from constructs import Construct
98
-
99
- LambdaToSagemakerEndpoint(
100
- self, 'LambdaToSagemakerEndpointPattern',
101
- model_props=sagemaker.CfnModelProps(
102
- primary_container=sagemaker.CfnModel.ContainerDefinitionProperty(
103
- image='<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
104
- model_data_url='s3://<bucket-name>/<prefix>/model.tar.gz',
105
- ),
106
- execution_role_arn="executionRoleArn"
107
- ),
108
- lambda_function_props=_lambda.FunctionProps(
109
- code=_lambda.Code.from_asset('lambda'),
110
- runtime=_lambda.Runtime.PYTHON_3_11,
111
- handler='index.handler',
112
- timeout=Duration.minutes(5),
113
- memory_size=128
114
- ))
115
- ```
116
-
117
- Java
118
-
119
- ```java
120
- import software.constructs.Construct;
121
-
122
- import software.amazon.awscdk.Stack;
123
- import software.amazon.awscdk.StackProps;
124
- import software.amazon.awscdk.Duration;
125
- import software.amazon.awscdk.services.lambda.*;
126
- import software.amazon.awscdk.services.lambda.Runtime;
127
- import software.amazon.awscdk.services.sagemaker.*;
128
- import software.amazon.awsconstructs.services.lambdasagemakerendpoint.*;
129
-
130
- new LambdaToSagemakerEndpoint(this, "LambdaToSagemakerEndpointPattern",
131
- new LambdaToSagemakerEndpointProps.Builder()
132
- .modelProps(new CfnModelProps.Builder()
133
- .primaryContainer(new CfnModel.ContainerDefinitionProperty.Builder()
134
- .image("<AccountId>.dkr.ecr.<region>.amazonaws.com/linear_learner:latest")
135
- .modelDataUrl("s3://<bucket_name>/<prefix>/model.tar.gz")
136
- .build())
137
- .executionRoleArn("executionRoleArn")
138
- .build())
139
- .lambdaFunctionProps(new FunctionProps.Builder()
140
- .runtime(Runtime.NODEJS_20_X)
141
- .code(Code.fromAsset("lambda"))
142
- .handler("index.handler")
143
- .timeout(Duration.minutes(5))
144
- .build())
145
- .build());
146
- ```
147
-
148
- ## Pattern Construct Props
149
-
150
- | **Name** | **Type** | **Description** |
151
- |:-------------|:----------------|-----------------|
152
- |existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|An optional, existing Lambda function to be used instead of the default function. Providing both this and `lambdaFunctionProps` will cause an error.|
153
- |lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|Optional user-provided properties to override the default properties for the Lambda function.|
154
- |existingSagemakerEndpointObj?|[`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html)|An optional, existing SageMaker Endpoint to be used. Providing both this and `endpointProps?` will cause an error.|
155
- |modelProps?|[`sagemaker.CfnModelProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModelProps.html) | `any`|User-provided properties to override the default properties for the SageMaker Model. At least `modelProps?.primaryContainer` must be provided to create a model. By default, the pattern will create a role with the minimum required permissions, but the client can provide a custom role with additional capabilities using `modelProps?.executionRoleArn`.|
156
- |endpointConfigProps?|[`sagemaker.CfnEndpointConfigProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfigProps.html)|Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
157
- |endpointProps?|[`sagemaker.CfnEndpointProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointProps.html)| Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
158
- |existingVpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html)|An optional, existing VPC into which this construct should be deployed. When deployed in a VPC, the Lambda function and Sagemaker Endpoint will use ENIs in the VPC to access network resources. An Interface Endpoint will be created in the VPC for Amazon SageMaker Runtime, and Amazon S3 VPC Endpoint. If an existing VPC is provided, the `deployVpc?` property cannot be `true`.|
159
- |vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcProps.html)|Optional user-provided properties to override the default properties for the new VPC. `enableDnsHostnames`, `enableDnsSupport`, `natGateways` and `subnetConfiguration` are set by the Construct, so any values for those properties supplied here will be overridden. If `deployVpc?` is not `true` then this property will be ignored.|
160
- |deployVpc?|`boolean`|Whether to create a new VPC based on `vpcProps` into which to deploy this pattern. Setting this to true will deploy the minimal, most private VPC to run the pattern:<ul><li> One isolated subnet in each Availability Zone used by the CDK program</li><li>`enableDnsHostnames` and `enableDnsSupport` will both be set to true</li></ul>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`.|
161
- |sagemakerEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the SageMaker endpoint. Default: SAGEMAKER_ENDPOINT_NAME |
162
-
163
- ## Pattern Properties
164
-
165
- | **Name** | **Type** | **Description** |
166
- | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
167
- | 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. |
168
- | sagemakerEndpoint | [`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpoint.html) | Returns an instance of the SageMaker Endpoint created by the pattern. |
169
- | sagemakerEndpointConfig? | [`sagemaker.CfnEndpointConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnEndpointConfig.html) | Returns an instance of the SageMaker EndpointConfig created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
170
- | sagemakerModel? | [`sagemaker.CfnModel`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sagemaker.CfnModel.html) | Returns an instance of the SageMaker Model created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
171
- | vpc? | `ec2.IVpc` | Returns an instance of the VPC created by the pattern, if `deployVpc?` is `true`, or `existingVpc?` is provided. |
172
-
173
- ## Default settings
174
-
175
- Out of the box implementation of the Construct without any override will set the following defaults:
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
- * Allow the function to invoke the SageMaker endpoint for Inferences
182
- * Configure the function to access resources in the VPC, where the SageMaker endpoint is deployed
183
- * Enable X-Ray Tracing
184
- * Set environment variables:
185
-
186
- * (default) SAGEMAKER_ENDPOINT_NAME
187
- * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions).
188
-
189
- ### Amazon SageMaker Endpoint
190
-
191
- * Configure limited privilege to create SageMaker resources
192
- * Deploy SageMaker model, endpointConfig, and endpoint
193
- * Configure the SageMaker endpoint to be deployed in a VPC
194
- * Deploy S3 VPC Endpoint and SageMaker Runtime VPC Interface
195
-
196
- ## Architecture
197
-
198
- ![Architecture Diagram](architecture.png)
199
-
200
- ---
201
-
202
-
203
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.