aws-lambda-sagemakerendpoint
| Reference Documentation: | https://docs.aws.amazon.com/solutions/latest/constructs/ |
| Language | Package |
|---|---|
|
|
|
|
|
|
|
|
|
Overview
This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon Sagemaker Endpoint.
Here is a minimal deployable pattern definition:
Example
Pattern Construct Props
| Name | Type | Description |
|---|---|---|
|
existingLambdaObj? |
Optional - instance of an existing Lambda Function object, providing both this and |
|
|
lambdaFunctionProps? |
Optional - user provided props to override the default props for the Lambda function. Providing both this and |
|
|
existingSagemakerEndpointObj? |
An optional, existing SageMaker Endpoint to be used. Providing both
this and |
|
|
modelProps? |
|
User-provided properties to override the default
properties for the SageMaker Model. At least
|
|
endpointConfigProps? |
Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
|
|
endpointProps? |
Optional user-provided properties to override the default properties for the SageMaker Endpoint Config. |
|
|
existingVpc? |
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 |
|
|
vpcProps? |
Optional user-provided properties to override the default properties
for the new VPC. |
|
|
deployVpc? |
|
Whether to create a new VPC based on |
|
sagemakerEnvironmentVariableName? |
|
Optional Name for the Lambda function environment variable set to the name of the SageMaker endpoint. Default: SAGEMAKER_ENDPOINT_NAME |
Pattern Properties
| Name | Type | Description |
|---|---|---|
|
lambdaFunction |
Returns an instance of the Lambda function created by the pattern. |
|
|
sagemakerEndpoint |
Returns an instance of the SageMaker Endpoint created by the pattern. |
|
|
sagemakerEndpointConfig? |
Returns an instance of the SageMaker EndpointConfig created by the
pattern, if |
|
|
sagemakerModel? |
Returns an instance of the SageMaker Model created by the pattern, if
|
|
|
vpc? |
|
Returns an instance of the VPC created by the
pattern, if |
Default settings
Out of the box implementation of the Construct without any override will set the following defaults:
AWS Lambda Function
-
Configure limited privilege access IAM role for Lambda function
-
Enable reusing connections with Keep-Alive for NodeJs Lambda function
-
Allow the function to invoke the SageMaker endpoint for Inferences
-
Configure the function to access resources in the VPC, where the SageMaker endpoint is deployed
-
Enable X-Ray Tracing
-
Set environment variables:
-
(default) SAGEMAKER_ENDPOINT_NAME
-
AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions).
-
Amazon SageMaker Endpoint
-
Configure limited privilege to create SageMaker resources
-
Deploy SageMaker model, endpointConfig, and endpoint
-
Configure the SageMaker endpoint to be deployed in a VPC
-
Deploy S3 VPC Endpoint and SageMaker Runtime VPC Interface
Architecture
Example Lambda Function Implementation
While Solutions Constructs does not publish code for the Lambda function to interact with SageMaker, this repo has several SageMaker examples: examples
Github
Go to the Github repo