Package: aws-solutions-constructs.aws-lambda-kendra
aws-lambda-kendra moduleAll classes are under active development and subject to non-backward compatible changes or removal in any
future version. These are not subject to theSemantic Versioningmodel.
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.Reference Documentation:https://docs.aws.amazon.com/solutions/latest/constructs/LanguagePackagePythonaws_solutions_constructs.aws_lambda_kendraTypescript@aws-solutions-constructs/aws-lambda-kendraJavasoftware.amazon.awsconstructs.services.lambdakendraOverviewThis AWS Solutions Construct implements an AWS Lambda function and Amazon Kendra index with the least privileged permissions.Here is a minimal deployable pattern definition:Typescriptimport{Construct}from'constructs';import{Stack,StackProps,Aws}from'aws-cdk-lib';import{LambdaToKendra}from'@aws-solutions-constructs/aws-lambda-kendra';import*aslambdafrom"aws-cdk-lib/aws-lambda";import*ass3from"aws-cdk-lib/aws-s3";constlambdaProps:lambda.FunctionProps={code:lambda.Code.fromAsset(`lambda`),runtime:lambda.Runtime.NODEJS_18_X,handler:'index.handler'};newLambdaToKendra(this,'sample',{lambdaFunctionProps:lambdaProps,kendraIndexProps:{},kendraDataSourceProps:[{type:'S3',dataSourceConfiguration:{s3Configuration:{bucketName:'your-bucket-name',}}],});PythonTBDJavaTBDPattern Construct PropsNameTypeDescriptionexistingLambdaObj?lambda.FunctionExisting instance of Lambda Function object, providing both this andlambdaFunctionPropswill cause an error.lambdaFunctionProps?lambda.FunctionPropsUser provided props to override the default props for the Lambda function.kendraIndexProps?kendra.CfnIndexPropsOptional user provided props to override the default props for the Kendra index. Providing both these and existingKendraIndexObj is an error.kendraDataSourcesPropsCfnDataSourceProps[]A list of data sources that will provide data to the Kendra index.At least 1 must be specified. We will do majority of processing for some data sources (S3 crawler initially), but for others the props must be complete (e.g. proper roleArn, etc.)indexPermissions?string[]Optional - index permissions to grant to the Lambda function. One or more of the following may be specified:Read,SubmitFeedbackandWrite. Default is["Read", "SubmitFeedback"]. Read is all the operations IAM defines as Read and List. SubmitFeedback is only the SubmitFeedback action. Write is all the operations IAM defines as Write and Tag. This functionality may be overridden by providing a specific role arn in lambdaFunctionPropsexistingKendraIndexObj?kendra.cfnIndexAn existing Kendra index to which the Lambda function will be granted access. Supplying along with kendraIndexProps or kendraDataSourceProps will throw an error.existingVpc?ec2.IVpcAn optional, existing VPC into which this pattern should be deployed. When deployed in a VPC, the Lambda function will use ENIs in the VPC to access network resources. If an existing VPC is provided, thedeployVpcproperty cannot betrue. This usesec2.IVpcto allow clients to supply VPCs that exist outside the stack using theec2.Vpc.fromLookup()method.vpcProps?ec2.VpcPropsOptional user provided properties to override the default properties for the new VPC.enableDnsHostnames,enableDnsSupport,natGatewaysandsubnetConfigurationare set by the pattern, so any values for those properties supplied here will be overridden. IfdeployVpcis nottruethen this property will be ignored.deployVpc?booleanWhether to create a new VPC based onvpcPropsinto which to deploy this pattern. Setting this totruewill deploy the minimal, most private VPC to run the pattern, consisting of (1) one isolated subnet in each Availability Zone used by the CDK program; and (2)enableDnsHostnamesandenableDnsSupportboth being set totrue. If this property istruethenexistingVpccannot be specified. Defaults tofalse.Pattern PropertiesNameTypeDescriptionlambdaFunctionlambda.FunctionReturns an instance oflambda.Functionmanaged by the constructkendraIndexkendra.cfnIndexReturns an instance ofkendra.cfnIndexmanaged by the constructkendraDataSourcesDataSourceProperties[] (this interface is defined by Solutions Constructs and described below)A list of data sources created for this construct/index, each in an object that includes the role for that data source.lambdaRoleiam.RoleThe role assumed by the Lambda functionvpc?ec2.IVpcReturns an interface on the VPC used by the pattern (if any). This may be a VPC created by the pattern or the VPC supplied to the pattern constructor.interface DataSourceProperties {
role?:iam.Role,
source: |CfnDataSource}Lambda FunctionThis pattern requires a lambda function that can access a Kendra index.Default settingsOut of the box implementation of the Construct without any overrides will set the following defaults:AWS Lambda FunctionConfigure limited privilege access IAM role for Lambda functionEnable reusing connections with Keep-Alive for Node.js Lambda functionEnable X-Ray TracingSet Environment Variables(default) KENDRA_INDEX_IDAWS_NODEJS_CONNECTION_REUSE_ENABLEDAmazon Kendra IndexCreates Amazon Kendra endpoint in VPC if appropriateDefaults to DEVELOPER_EDITIONAmazon Kendra DataSourcesSets up correct IAM roles to access data for:S3 data sourcesWhich others should we support in MLP?https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.htmlAdds each data source to Kendra indexArchitecture© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.