Metadata-Version: 2.1
Name: aws-solutions-constructs.aws-lambda-sagemakerendpoint
Version: 1.108.1
Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SageMaker inference endpoint.
Home-page: https://github.com/awslabs/aws-solutions-constructs.git
Author: Amazon Web Services
License: Apache-2.0
Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
Description: # aws-lambda-sagemakerendpoint module
        
        <!--BEGIN STABILITY BANNER-->---
        
        
        ![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
        
        > All classes are under active development and subject to non-backward compatible changes or removal in any
        > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.
        > 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.
        
        ---
        <!--END STABILITY BANNER-->
        
        | **Reference Documentation**: | <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span> |
        | :--------------------------- | :------------------------------------------------------------------------------------------------ |
        
        <div style="height:8px"></div>
        
        | **Language**                                                                                   | **Package**                                                      |
        | :--------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
        | ![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python             | `aws_solutions_constructs.aws_lambda_sagemakerendpoint`          |
        | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-sagemakerendpoint`         |
        | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java                   | `software.amazon.awsconstructs.services.lambdasagemakerendpoint` |
        
        This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon Sagemaker Endpoint.
        
        Here is a minimal deployable pattern definition in Typescript:
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        from aws_cdk.core import Duration
        import aws_cdk.aws_lambda as lambda_
        from aws_solutions_constructs.aws_lambda_sagemakerendpoint import LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps
        
        construct_props = LambdaToSagemakerEndpointProps(
            model_props={
                "primary_container": {
                    "image": "<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest",
                    "model_data_url": "s3://<bucket-name>/<prefix>/model.tar.gz"
                }
            },
            lambda_function_props=FunctionProps(
                runtime=lambda_.Runtime.PYTHON_3_8,
                code=lambda_.Code.from_asset(f"{__dirname}/lambda"),
                handler="index.handler",
                timeout=Duration.minutes(5),
                memory_size=128
            )
        )
        
        LambdaToSagemakerEndpoint(self, "LambdaToSagemakerEndpointPattern", construct_props)
        ```
        
        ## Initializer
        
        ```text
        new LambdaToSagemakerEndpoint(scope: Construct, id: string, props: LambdaToSagemakerEndpointProps);
        ```
        
        *Parameters*
        
        * scope [`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html)
        * id `string`
        * props [`LambdaToSagemakerEndpointProps`](#pattern-construct-props)
        
        ## Pattern Construct Props
        
        | **Name**     | **Type**        | **Description** |
        |:-------------|:----------------|-----------------|
        |existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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.|
        |lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|Optional user-provided properties to override the default properties for the Lambda function.|
        |existingSagemakerEndpointObj?|[`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sagemaker.CfnEndpoint.html)|An optional, existing Sagemaker Enpoint to be used. Providing both this and `endpointProps?` will cause an error.|
        |modelProps?|[`sagemaker.CfnModelProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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`.|
        |endpointConfigProps?|[`sagemaker.CfnEndpointConfigProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sagemaker.CfnEndpointConfigProps.html)|Optional user-provided properties to override the default properties for the Sagemaker Endpoint Config. |
        |endpointProps?|[`sagemaker.CfnEndpointProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sagemaker.CfnEndpointProps.html)| Optional user-provided properties to override the default properties for the Sagemaker Endpoint Config. |
        |existingVpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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`.|
        |vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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 overrriden. If `deployVpc?` is not `true` then this property will be ignored.|
        |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`.|
        |sagemakerEnvironmentVariableName?|`string`|Optional Name for the SageMaker endpoint environment variable set for the Lambda function.|
        
        ## Pattern Properties
        
        | **Name**                 | **Type**                                                                                                                       | **Description**                                                                                                                 |
        | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
        | lambdaFunction           | [`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)                         | Returns an instance of the Lambda function created by the pattern.                                                              |
        | sagemakerEndpoint        | [`sagemaker.CfnEndpoint`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sagemaker.CfnEndpoint.html)             | Returns an instance of the Sagemaker Endpoint created by the pattern.                                                           |
        | sagemakerEndpointConfig? | [`sagemaker.CfnEndpointConfig`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sagemaker.CfnEndpointConfig.html) | Returns an instance of the SageMaker EndpointConfig created by the pattern, if `existingSagemakerEndpointObj?` is not provided. |
        | sagemakerModel?          | [`sagemaker.CfnModel`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sagemaker.CfnModel.html)                   | Returns an instance of the Sagemaker Model created by the pattern, if `existingSagemakerEndpointObj?` is not provided.          |
        | vpc?                     | `ec2.IVpc`                                                                                                                     | Returns an instance of the VPC created by the pattern, if `deployVpc?` is `true`, or `existingVpc?` is provided.                |
        
        ## 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
        
        ![Architecture Diagram](architecture.png)
        
        ---
        
        
        © Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
        
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Typing :: Typed
Classifier: License :: OSI Approved
Requires-Python: >=3.6
Description-Content-Type: text/markdown
