aws-solutions-constructs.aws-lambda-kendra 2.44.0__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 (16) hide show
  1. aws-solutions-constructs.aws-lambda-kendra-2.44.0/LICENSE +73 -0
  2. aws-solutions-constructs.aws-lambda-kendra-2.44.0/MANIFEST.in +1 -0
  3. aws-solutions-constructs.aws-lambda-kendra-2.44.0/PKG-INFO +161 -0
  4. aws-solutions-constructs.aws-lambda-kendra-2.44.0/README.md +138 -0
  5. aws-solutions-constructs.aws-lambda-kendra-2.44.0/pyproject.toml +9 -0
  6. aws-solutions-constructs.aws-lambda-kendra-2.44.0/setup.cfg +4 -0
  7. aws-solutions-constructs.aws-lambda-kendra-2.44.0/setup.py +66 -0
  8. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs/aws_lambda_kendra/__init__.py +484 -0
  9. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs/aws_lambda_kendra/_jsii/__init__.py +28 -0
  10. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs/aws_lambda_kendra/_jsii/aws-lambda-kendra@2.44.0.jsii.tgz +0 -0
  11. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs/aws_lambda_kendra/py.typed +1 -0
  12. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs.aws_lambda_kendra.egg-info/PKG-INFO +161 -0
  13. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs.aws_lambda_kendra.egg-info/SOURCES.txt +14 -0
  14. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs.aws_lambda_kendra.egg-info/dependency_links.txt +1 -0
  15. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs.aws_lambda_kendra.egg-info/requires.txt +6 -0
  16. aws-solutions-constructs.aws-lambda-kendra-2.44.0/src/aws_solutions_constructs.aws_lambda_kendra.egg-info/top_level.txt +1 -0
@@ -0,0 +1,73 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright [yyyy] [name of copyright owner]
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
@@ -0,0 +1 @@
1
+ include pyproject.toml
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-lambda-kendra
3
+ Version: 2.44.0
4
+ Summary: CDK constructs for defining an interaction between an AWS Lambda function and an existing Amazon Kinesis Firehose Delivery Stream.
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.7
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Typing :: Typed
19
+ Classifier: License :: OSI Approved
20
+ Requires-Python: ~=3.7
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+
24
+ # aws-lambda-kendra module
25
+
26
+ ---
27
+
28
+
29
+ ![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
30
+
31
+ > All classes are under active development and subject to non-backward compatible changes or removal in any
32
+ > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.
33
+ > 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.
34
+
35
+ ---
36
+
37
+
38
+ | **Reference Documentation**: | <span style="font-weight: normal;">https://docs.aws.amazon.com/solutions/latest/constructs/</span> |
39
+ | --- | --- |
40
+
41
+ | **Language** | **Package** |
42
+ | --- | --- |
43
+ | ![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python | `aws_solutions_constructs.aws_lambda_kendra` |
44
+ | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-kendra` |
45
+ | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdakendra` |
46
+
47
+ ## Overview
48
+
49
+ This AWS Solutions Construct implements an AWS Lambda function and Amazon Kendra index with the least privileged permissions.
50
+
51
+ Here is a minimal deployable pattern definition:
52
+
53
+ Typescript
54
+
55
+ ```python
56
+ import { Construct } from 'constructs';
57
+ import { Stack, StackProps, Aws } from 'aws-cdk-lib';
58
+ import { LambdaToKendra } from '@aws-solutions-constructs/aws-lambda-kendra';
59
+ import * as lambda from "aws-cdk-lib/aws-lambda";
60
+ import * as s3 from "aws-cdk-lib/aws-s3";
61
+
62
+ const lambdaProps: lambda.FunctionProps = {
63
+ code: lambda.Code.fromAsset(`lambda`),
64
+ runtime: lambda.Runtime.NODEJS_18_X,
65
+ handler: 'index.handler'
66
+ };
67
+
68
+ new LambdaToKendra(this, 'sample', {
69
+ lambdaFunctionProps: lambdaProps,
70
+ kendraIndexProps: {},
71
+ kendraDataSourceProps: [{
72
+ type: 'S3',
73
+ dataSourceConfiguration: {
74
+ s3Configuration: {
75
+ bucketName: 'your-bucket-name',
76
+ }
77
+ }
78
+ ],
79
+ });
80
+ ```
81
+
82
+ Python
83
+
84
+ ```python
85
+ TBD
86
+ ```
87
+
88
+ Java
89
+
90
+ ```java
91
+ TBD
92
+ ```
93
+
94
+ ## Pattern Construct Props
95
+
96
+ | **Name** | **Type** | **Description** |
97
+ | --- | --- | --- |
98
+ | 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. |
99
+ | lambdaFunctionProps? | [`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html) | User provided props to override the default props for the Lambda function. |
100
+ | kendraIndexProps? | [`kendra.CfnIndexProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Optional user provided props to override the default props for the Kendra index. Providing both these and existingKendraIndexObj is an error. |
101
+ | kendraDataSourcesProps | [`CfnDataSourceProps[]`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html) | 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.) |
102
+ | indexPermissions? | `string[]` | Optional - index permissions to grant to the Lambda function. One or more of the following may be specified: `Read`, `SubmitFeedback` and `Write`. 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 lambdaFunctionProps |
103
+ | existingKendraIndexObj? | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | An existing Kendra index to which the Lambda function will be granted access. Supplying along with kendraIndexProps or kendraDataSourceProps will throw an error. |
104
+ | 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 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, the `deployVpc` property cannot be `true`. This uses `ec2.IVpc` to allow clients to supply VPCs that exist outside the stack using the [`ec2.Vpc.fromLookup()`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html#static-fromwbrlookupscope-id-options) method. |
105
+ | 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 pattern, so any values for those properties supplied here will be overridden. If `deployVpc` is not `true` then this property will be ignored. |
106
+ | 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:<br>- One isolated subnet in each Availability Zone used by the CDK program<br>- `enableDnsHostnames` and `enableDnsSupport` will both be set to true<br>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`. |
107
+
108
+ ## Pattern Properties
109
+
110
+ | **Name** | **Type** | **Description** |
111
+ | --- | --- | --- |
112
+ | lambdaFunction | [`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html) | Returns an instance of `lambda.Function` managed by the construct |
113
+ | kendraIndex | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Returns an instance of `kendra.cfnIndex` managed by the construct |
114
+ | kendraDataSources | DataSourceProperties[] (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. |
115
+ | lambdaRole | [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html) | The role assumed by the Lambda function |
116
+ | vpc? | [`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | Returns 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. |
117
+
118
+ interface DataSourceProperties {
119
+ role?: [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html),
120
+ source: | [`CfnDataSource`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html)
121
+ }
122
+
123
+ ## Lambda Function
124
+
125
+ This pattern requires a lambda function that can access a Kendra index.
126
+
127
+ ## Default settings
128
+
129
+ Out of the box implementation of the Construct without any overrides will set the following defaults:
130
+
131
+ ### AWS Lambda Function
132
+
133
+ * Configure limited privilege access IAM role for Lambda function
134
+ * Enable reusing connections with Keep-Alive for Node.js Lambda function
135
+ * Enable X-Ray Tracing
136
+ * Set Environment Variables
137
+
138
+ * (default) KENDRA_INDEX_ID
139
+ * AWS_NODEJS_CONNECTION_REUSE_ENABLED
140
+
141
+ ### Amazon Kendra Index
142
+
143
+ * Creates Amazon Kendra endpoint in VPC if appropriate
144
+ * Defaults to DEVELOPER_EDITION
145
+
146
+ **Amazon Kendra DataSources**
147
+
148
+ * Sets up correct IAM roles to access data for:
149
+
150
+ * S3 data sources
151
+ * Which others should we support in MLP? https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html
152
+ * Adds each data source to Kendra index
153
+
154
+ ## Architecture
155
+
156
+ ![Architecture Diagram](architecture.png)
157
+
158
+ ---
159
+
160
+
161
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,138 @@
1
+ # aws-lambda-kendra module
2
+
3
+ ---
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
+
14
+
15
+ | **Reference Documentation**: | <span style="font-weight: normal;">https://docs.aws.amazon.com/solutions/latest/constructs/</span> |
16
+ | --- | --- |
17
+
18
+ | **Language** | **Package** |
19
+ | --- | --- |
20
+ | ![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python | `aws_solutions_constructs.aws_lambda_kendra` |
21
+ | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-kendra` |
22
+ | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdakendra` |
23
+
24
+ ## Overview
25
+
26
+ This AWS Solutions Construct implements an AWS Lambda function and Amazon Kendra index with the least privileged permissions.
27
+
28
+ Here is a minimal deployable pattern definition:
29
+
30
+ Typescript
31
+
32
+ ```python
33
+ import { Construct } from 'constructs';
34
+ import { Stack, StackProps, Aws } from 'aws-cdk-lib';
35
+ import { LambdaToKendra } from '@aws-solutions-constructs/aws-lambda-kendra';
36
+ import * as lambda from "aws-cdk-lib/aws-lambda";
37
+ import * as s3 from "aws-cdk-lib/aws-s3";
38
+
39
+ const lambdaProps: lambda.FunctionProps = {
40
+ code: lambda.Code.fromAsset(`lambda`),
41
+ runtime: lambda.Runtime.NODEJS_18_X,
42
+ handler: 'index.handler'
43
+ };
44
+
45
+ new LambdaToKendra(this, 'sample', {
46
+ lambdaFunctionProps: lambdaProps,
47
+ kendraIndexProps: {},
48
+ kendraDataSourceProps: [{
49
+ type: 'S3',
50
+ dataSourceConfiguration: {
51
+ s3Configuration: {
52
+ bucketName: 'your-bucket-name',
53
+ }
54
+ }
55
+ ],
56
+ });
57
+ ```
58
+
59
+ Python
60
+
61
+ ```python
62
+ TBD
63
+ ```
64
+
65
+ Java
66
+
67
+ ```java
68
+ TBD
69
+ ```
70
+
71
+ ## Pattern Construct Props
72
+
73
+ | **Name** | **Type** | **Description** |
74
+ | --- | --- | --- |
75
+ | 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. |
76
+ | lambdaFunctionProps? | [`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html) | User provided props to override the default props for the Lambda function. |
77
+ | kendraIndexProps? | [`kendra.CfnIndexProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Optional user provided props to override the default props for the Kendra index. Providing both these and existingKendraIndexObj is an error. |
78
+ | kendraDataSourcesProps | [`CfnDataSourceProps[]`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html) | 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.) |
79
+ | indexPermissions? | `string[]` | Optional - index permissions to grant to the Lambda function. One or more of the following may be specified: `Read`, `SubmitFeedback` and `Write`. 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 lambdaFunctionProps |
80
+ | existingKendraIndexObj? | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | An existing Kendra index to which the Lambda function will be granted access. Supplying along with kendraIndexProps or kendraDataSourceProps will throw an error. |
81
+ | 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 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, the `deployVpc` property cannot be `true`. This uses `ec2.IVpc` to allow clients to supply VPCs that exist outside the stack using the [`ec2.Vpc.fromLookup()`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html#static-fromwbrlookupscope-id-options) method. |
82
+ | 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 pattern, so any values for those properties supplied here will be overridden. If `deployVpc` is not `true` then this property will be ignored. |
83
+ | 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:<br>- One isolated subnet in each Availability Zone used by the CDK program<br>- `enableDnsHostnames` and `enableDnsSupport` will both be set to true<br>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`. |
84
+
85
+ ## Pattern Properties
86
+
87
+ | **Name** | **Type** | **Description** |
88
+ | --- | --- | --- |
89
+ | lambdaFunction | [`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html) | Returns an instance of `lambda.Function` managed by the construct |
90
+ | kendraIndex | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Returns an instance of `kendra.cfnIndex` managed by the construct |
91
+ | kendraDataSources | DataSourceProperties[] (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. |
92
+ | lambdaRole | [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html) | The role assumed by the Lambda function |
93
+ | vpc? | [`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | Returns 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. |
94
+
95
+ interface DataSourceProperties {
96
+ role?: [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html),
97
+ source: | [`CfnDataSource`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html)
98
+ }
99
+
100
+ ## Lambda Function
101
+
102
+ This pattern requires a lambda function that can access a Kendra index.
103
+
104
+ ## Default settings
105
+
106
+ Out of the box implementation of the Construct without any overrides will set the following defaults:
107
+
108
+ ### AWS Lambda Function
109
+
110
+ * Configure limited privilege access IAM role for Lambda function
111
+ * Enable reusing connections with Keep-Alive for Node.js Lambda function
112
+ * Enable X-Ray Tracing
113
+ * Set Environment Variables
114
+
115
+ * (default) KENDRA_INDEX_ID
116
+ * AWS_NODEJS_CONNECTION_REUSE_ENABLED
117
+
118
+ ### Amazon Kendra Index
119
+
120
+ * Creates Amazon Kendra endpoint in VPC if appropriate
121
+ * Defaults to DEVELOPER_EDITION
122
+
123
+ **Amazon Kendra DataSources**
124
+
125
+ * Sets up correct IAM roles to access data for:
126
+
127
+ * S3 data sources
128
+ * Which others should we support in MLP? https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html
129
+ * Adds each data source to Kendra index
130
+
131
+ ## Architecture
132
+
133
+ ![Architecture Diagram](architecture.png)
134
+
135
+ ---
136
+
137
+
138
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,9 @@
1
+ [build-system]
2
+ requires = ["setuptools~=67.3.2", "wheel~=0.41"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.pyright]
6
+ defineConstant = { DEBUG = true }
7
+ pythonVersion = "3.7"
8
+ pythonPlatform = "All"
9
+ reportSelfClsParameterName = false
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,66 @@
1
+ import json
2
+ import setuptools
3
+
4
+ kwargs = json.loads(
5
+ """
6
+ {
7
+ "name": "aws-solutions-constructs.aws-lambda-kendra",
8
+ "version": "2.44.0",
9
+ "description": "CDK constructs for defining an interaction between an AWS Lambda function and an existing Amazon Kinesis Firehose Delivery Stream.",
10
+ "license": "Apache-2.0",
11
+ "url": "https://github.com/awslabs/aws-solutions-constructs.git",
12
+ "long_description_content_type": "text/markdown",
13
+ "author": "Amazon Web Services",
14
+ "bdist_wheel": {
15
+ "universal": true
16
+ },
17
+ "project_urls": {
18
+ "Source": "https://github.com/awslabs/aws-solutions-constructs.git"
19
+ },
20
+ "package_dir": {
21
+ "": "src"
22
+ },
23
+ "packages": [
24
+ "aws_solutions_constructs.aws_lambda_kendra",
25
+ "aws_solutions_constructs.aws_lambda_kendra._jsii"
26
+ ],
27
+ "package_data": {
28
+ "aws_solutions_constructs.aws_lambda_kendra._jsii": [
29
+ "aws-lambda-kendra@2.44.0.jsii.tgz"
30
+ ],
31
+ "aws_solutions_constructs.aws_lambda_kendra": [
32
+ "py.typed"
33
+ ]
34
+ },
35
+ "python_requires": "~=3.7",
36
+ "install_requires": [
37
+ "aws-cdk-lib>=2.82.0, <3.0.0",
38
+ "aws-solutions-constructs.core==2.44.0",
39
+ "constructs>=10.0.0, <11.0.0",
40
+ "jsii>=1.88.0, <2.0.0",
41
+ "publication>=0.0.3",
42
+ "typeguard~=2.13.3"
43
+ ],
44
+ "classifiers": [
45
+ "Intended Audience :: Developers",
46
+ "Operating System :: OS Independent",
47
+ "Programming Language :: JavaScript",
48
+ "Programming Language :: Python :: 3 :: Only",
49
+ "Programming Language :: Python :: 3.7",
50
+ "Programming Language :: Python :: 3.8",
51
+ "Programming Language :: Python :: 3.9",
52
+ "Programming Language :: Python :: 3.10",
53
+ "Programming Language :: Python :: 3.11",
54
+ "Typing :: Typed",
55
+ "License :: OSI Approved"
56
+ ],
57
+ "scripts": []
58
+ }
59
+ """
60
+ )
61
+
62
+ with open("README.md", encoding="utf8") as fp:
63
+ kwargs["long_description"] = fp.read()
64
+
65
+
66
+ setuptools.setup(**kwargs)
@@ -0,0 +1,484 @@
1
+ '''
2
+ # aws-lambda-kendra module
3
+
4
+ ---
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
+
15
+
16
+ | **Reference Documentation**: | <span style="font-weight: normal;">https://docs.aws.amazon.com/solutions/latest/constructs/</span> |
17
+ | --- | --- |
18
+
19
+ | **Language** | **Package** |
20
+ | --- | --- |
21
+ | ![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python | `aws_solutions_constructs.aws_lambda_kendra` |
22
+ | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-kendra` |
23
+ | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdakendra` |
24
+
25
+ ## Overview
26
+
27
+ This AWS Solutions Construct implements an AWS Lambda function and Amazon Kendra index with the least privileged permissions.
28
+
29
+ Here is a minimal deployable pattern definition:
30
+
31
+ Typescript
32
+
33
+ ```python
34
+ import { Construct } from 'constructs';
35
+ import { Stack, StackProps, Aws } from 'aws-cdk-lib';
36
+ import { LambdaToKendra } from '@aws-solutions-constructs/aws-lambda-kendra';
37
+ import * as lambda from "aws-cdk-lib/aws-lambda";
38
+ import * as s3 from "aws-cdk-lib/aws-s3";
39
+
40
+ const lambdaProps: lambda.FunctionProps = {
41
+ code: lambda.Code.fromAsset(`lambda`),
42
+ runtime: lambda.Runtime.NODEJS_18_X,
43
+ handler: 'index.handler'
44
+ };
45
+
46
+ new LambdaToKendra(this, 'sample', {
47
+ lambdaFunctionProps: lambdaProps,
48
+ kendraIndexProps: {},
49
+ kendraDataSourceProps: [{
50
+ type: 'S3',
51
+ dataSourceConfiguration: {
52
+ s3Configuration: {
53
+ bucketName: 'your-bucket-name',
54
+ }
55
+ }
56
+ ],
57
+ });
58
+ ```
59
+
60
+ Python
61
+
62
+ ```python
63
+ TBD
64
+ ```
65
+
66
+ Java
67
+
68
+ ```java
69
+ TBD
70
+ ```
71
+
72
+ ## Pattern Construct Props
73
+
74
+ | **Name** | **Type** | **Description** |
75
+ | --- | --- | --- |
76
+ | 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. |
77
+ | lambdaFunctionProps? | [`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html) | User provided props to override the default props for the Lambda function. |
78
+ | kendraIndexProps? | [`kendra.CfnIndexProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Optional user provided props to override the default props for the Kendra index. Providing both these and existingKendraIndexObj is an error. |
79
+ | kendraDataSourcesProps | [`CfnDataSourceProps[]`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html) | 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.) |
80
+ | indexPermissions? | `string[]` | Optional - index permissions to grant to the Lambda function. One or more of the following may be specified: `Read`, `SubmitFeedback` and `Write`. 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 lambdaFunctionProps |
81
+ | existingKendraIndexObj? | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | An existing Kendra index to which the Lambda function will be granted access. Supplying along with kendraIndexProps or kendraDataSourceProps will throw an error. |
82
+ | 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 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, the `deployVpc` property cannot be `true`. This uses `ec2.IVpc` to allow clients to supply VPCs that exist outside the stack using the [`ec2.Vpc.fromLookup()`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html#static-fromwbrlookupscope-id-options) method. |
83
+ | 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 pattern, so any values for those properties supplied here will be overridden. If `deployVpc` is not `true` then this property will be ignored. |
84
+ | 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:<br>- One isolated subnet in each Availability Zone used by the CDK program<br>- `enableDnsHostnames` and `enableDnsSupport` will both be set to true<br>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`. |
85
+
86
+ ## Pattern Properties
87
+
88
+ | **Name** | **Type** | **Description** |
89
+ | --- | --- | --- |
90
+ | lambdaFunction | [`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html) | Returns an instance of `lambda.Function` managed by the construct |
91
+ | kendraIndex | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Returns an instance of `kendra.cfnIndex` managed by the construct |
92
+ | kendraDataSources | DataSourceProperties[] (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. |
93
+ | lambdaRole | [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html) | The role assumed by the Lambda function |
94
+ | vpc? | [`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | Returns 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. |
95
+
96
+ interface DataSourceProperties {
97
+ role?: [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html),
98
+ source: | [`CfnDataSource`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html)
99
+ }
100
+
101
+ ## Lambda Function
102
+
103
+ This pattern requires a lambda function that can access a Kendra index.
104
+
105
+ ## Default settings
106
+
107
+ Out of the box implementation of the Construct without any overrides will set the following defaults:
108
+
109
+ ### AWS Lambda Function
110
+
111
+ * Configure limited privilege access IAM role for Lambda function
112
+ * Enable reusing connections with Keep-Alive for Node.js Lambda function
113
+ * Enable X-Ray Tracing
114
+ * Set Environment Variables
115
+
116
+ * (default) KENDRA_INDEX_ID
117
+ * AWS_NODEJS_CONNECTION_REUSE_ENABLED
118
+
119
+ ### Amazon Kendra Index
120
+
121
+ * Creates Amazon Kendra endpoint in VPC if appropriate
122
+ * Defaults to DEVELOPER_EDITION
123
+
124
+ **Amazon Kendra DataSources**
125
+
126
+ * Sets up correct IAM roles to access data for:
127
+
128
+ * S3 data sources
129
+ * Which others should we support in MLP? https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html
130
+ * Adds each data source to Kendra index
131
+
132
+ ## Architecture
133
+
134
+ ![Architecture Diagram](architecture.png)
135
+
136
+ ---
137
+
138
+
139
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
140
+ '''
141
+ import abc
142
+ import builtins
143
+ import datetime
144
+ import enum
145
+ import typing
146
+
147
+ import jsii
148
+ import publication
149
+ import typing_extensions
150
+
151
+ from typeguard import check_type
152
+
153
+ from ._jsii import *
154
+
155
+ import aws_cdk.aws_ec2 as _aws_cdk_aws_ec2_ceddda9d
156
+ import aws_cdk.aws_kendra as _aws_cdk_aws_kendra_ceddda9d
157
+ import aws_cdk.aws_lambda as _aws_cdk_aws_lambda_ceddda9d
158
+ import constructs as _constructs_77d1e7e8
159
+
160
+
161
+ class LambdaToKendra(
162
+ _constructs_77d1e7e8.Construct,
163
+ metaclass=jsii.JSIIMeta,
164
+ jsii_type="@aws-solutions-constructs/aws-lambda-kendra.LambdaToKendra",
165
+ ):
166
+ '''
167
+ :summary: The LambdaToKendra class.
168
+ '''
169
+
170
+ def __init__(
171
+ self,
172
+ scope: _constructs_77d1e7e8.Construct,
173
+ id: builtins.str,
174
+ *,
175
+ kendra_data_sources_props: typing.Sequence[typing.Any],
176
+ deploy_vpc: typing.Optional[builtins.bool] = None,
177
+ existing_kendra_index_obj: typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndex] = None,
178
+ existing_lambda_obj: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Function] = None,
179
+ existing_vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
180
+ index_id_environment_variable_name: typing.Optional[builtins.str] = None,
181
+ index_permissions: typing.Optional[typing.Sequence[builtins.str]] = None,
182
+ kendra_index_props: typing.Optional[typing.Union[_aws_cdk_aws_kendra_ceddda9d.CfnIndexProps, typing.Dict[builtins.str, typing.Any]]] = None,
183
+ lambda_function_props: typing.Optional[typing.Union[_aws_cdk_aws_lambda_ceddda9d.FunctionProps, typing.Dict[builtins.str, typing.Any]]] = None,
184
+ vpc_props: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.VpcProps, typing.Dict[builtins.str, typing.Any]]] = None,
185
+ ) -> None:
186
+ '''
187
+ :param scope: - represents the scope for all the resources.
188
+ :param id: - this is a a scope-unique id.
189
+ :param kendra_data_sources_props: 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.) Default: - empty list (no data sources)
190
+ :param deploy_vpc: Whether to deploy a new VPC. Default: - false
191
+ :param existing_kendra_index_obj: Existing instance of a Kendra Index. Providing both this and kendraIndexProps will cause an error. Default: - None
192
+ :param existing_lambda_obj: Existing instance of Lambda Function object, providing both this and ``lambdaFunctionProps`` will cause an error. Default: - None
193
+ :param existing_vpc: An existing VPC for the construct to use (construct will NOT create a new VPC in this case).
194
+ :param index_id_environment_variable_name: Optional Name for the Lambda function environment variable set to the index id for the Kendra index. Default: - KENDRA_INDEX_ID
195
+ :param index_permissions: Optional - index permissions to grant to the Lambda function. One or more of the following may be specified: ``Read``, ``SubmitFeedback`` and ``Write``. 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 lambdaFunctionProps Default: - ["Read", "SubmitFeedback"]
196
+ :param kendra_index_props: Default: - Optional user provided props to override the default props for the Kendra index. Is this required?
197
+ :param lambda_function_props: User provided props to override the default props for the Lambda function. Default: - Default properties are used.
198
+ :param vpc_props: Properties to override default properties if deployVpc is true.
199
+
200
+ :access: public
201
+ :since: 1.120.0
202
+ :summary: Constructs a new instance of the LambdaToKendra class.
203
+ '''
204
+ if __debug__:
205
+ type_hints = typing.get_type_hints(_typecheckingstub__9da37223ecd15aa48c8fdb15e8ae674033a9aa9395fc3369ba9f24ea9cae4ca1)
206
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
207
+ check_type(argname="argument id", value=id, expected_type=type_hints["id"])
208
+ props = LambdaToKendraProps(
209
+ kendra_data_sources_props=kendra_data_sources_props,
210
+ deploy_vpc=deploy_vpc,
211
+ existing_kendra_index_obj=existing_kendra_index_obj,
212
+ existing_lambda_obj=existing_lambda_obj,
213
+ existing_vpc=existing_vpc,
214
+ index_id_environment_variable_name=index_id_environment_variable_name,
215
+ index_permissions=index_permissions,
216
+ kendra_index_props=kendra_index_props,
217
+ lambda_function_props=lambda_function_props,
218
+ vpc_props=vpc_props,
219
+ )
220
+
221
+ jsii.create(self.__class__, self, [scope, id, props])
222
+
223
+ @builtins.property
224
+ @jsii.member(jsii_name="kendraDataSources")
225
+ def kendra_data_sources(
226
+ self,
227
+ ) -> typing.List[_aws_cdk_aws_kendra_ceddda9d.CfnDataSource]:
228
+ return typing.cast(typing.List[_aws_cdk_aws_kendra_ceddda9d.CfnDataSource], jsii.get(self, "kendraDataSources"))
229
+
230
+ @builtins.property
231
+ @jsii.member(jsii_name="kendraIndex")
232
+ def kendra_index(self) -> _aws_cdk_aws_kendra_ceddda9d.CfnIndex:
233
+ return typing.cast(_aws_cdk_aws_kendra_ceddda9d.CfnIndex, jsii.get(self, "kendraIndex"))
234
+
235
+ @builtins.property
236
+ @jsii.member(jsii_name="lambdaFunction")
237
+ def lambda_function(self) -> _aws_cdk_aws_lambda_ceddda9d.Function:
238
+ return typing.cast(_aws_cdk_aws_lambda_ceddda9d.Function, jsii.get(self, "lambdaFunction"))
239
+
240
+ @builtins.property
241
+ @jsii.member(jsii_name="vpc")
242
+ def vpc(self) -> typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc]:
243
+ return typing.cast(typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc], jsii.get(self, "vpc"))
244
+
245
+
246
+ @jsii.data_type(
247
+ jsii_type="@aws-solutions-constructs/aws-lambda-kendra.LambdaToKendraProps",
248
+ jsii_struct_bases=[],
249
+ name_mapping={
250
+ "kendra_data_sources_props": "kendraDataSourcesProps",
251
+ "deploy_vpc": "deployVpc",
252
+ "existing_kendra_index_obj": "existingKendraIndexObj",
253
+ "existing_lambda_obj": "existingLambdaObj",
254
+ "existing_vpc": "existingVpc",
255
+ "index_id_environment_variable_name": "indexIdEnvironmentVariableName",
256
+ "index_permissions": "indexPermissions",
257
+ "kendra_index_props": "kendraIndexProps",
258
+ "lambda_function_props": "lambdaFunctionProps",
259
+ "vpc_props": "vpcProps",
260
+ },
261
+ )
262
+ class LambdaToKendraProps:
263
+ def __init__(
264
+ self,
265
+ *,
266
+ kendra_data_sources_props: typing.Sequence[typing.Any],
267
+ deploy_vpc: typing.Optional[builtins.bool] = None,
268
+ existing_kendra_index_obj: typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndex] = None,
269
+ existing_lambda_obj: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Function] = None,
270
+ existing_vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
271
+ index_id_environment_variable_name: typing.Optional[builtins.str] = None,
272
+ index_permissions: typing.Optional[typing.Sequence[builtins.str]] = None,
273
+ kendra_index_props: typing.Optional[typing.Union[_aws_cdk_aws_kendra_ceddda9d.CfnIndexProps, typing.Dict[builtins.str, typing.Any]]] = None,
274
+ lambda_function_props: typing.Optional[typing.Union[_aws_cdk_aws_lambda_ceddda9d.FunctionProps, typing.Dict[builtins.str, typing.Any]]] = None,
275
+ vpc_props: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.VpcProps, typing.Dict[builtins.str, typing.Any]]] = None,
276
+ ) -> None:
277
+ '''
278
+ :param kendra_data_sources_props: 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.) Default: - empty list (no data sources)
279
+ :param deploy_vpc: Whether to deploy a new VPC. Default: - false
280
+ :param existing_kendra_index_obj: Existing instance of a Kendra Index. Providing both this and kendraIndexProps will cause an error. Default: - None
281
+ :param existing_lambda_obj: Existing instance of Lambda Function object, providing both this and ``lambdaFunctionProps`` will cause an error. Default: - None
282
+ :param existing_vpc: An existing VPC for the construct to use (construct will NOT create a new VPC in this case).
283
+ :param index_id_environment_variable_name: Optional Name for the Lambda function environment variable set to the index id for the Kendra index. Default: - KENDRA_INDEX_ID
284
+ :param index_permissions: Optional - index permissions to grant to the Lambda function. One or more of the following may be specified: ``Read``, ``SubmitFeedback`` and ``Write``. 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 lambdaFunctionProps Default: - ["Read", "SubmitFeedback"]
285
+ :param kendra_index_props: Default: - Optional user provided props to override the default props for the Kendra index. Is this required?
286
+ :param lambda_function_props: User provided props to override the default props for the Lambda function. Default: - Default properties are used.
287
+ :param vpc_props: Properties to override default properties if deployVpc is true.
288
+
289
+ :summary: The properties for the LambdaToKendra class.
290
+ '''
291
+ if isinstance(kendra_index_props, dict):
292
+ kendra_index_props = _aws_cdk_aws_kendra_ceddda9d.CfnIndexProps(**kendra_index_props)
293
+ if isinstance(lambda_function_props, dict):
294
+ lambda_function_props = _aws_cdk_aws_lambda_ceddda9d.FunctionProps(**lambda_function_props)
295
+ if isinstance(vpc_props, dict):
296
+ vpc_props = _aws_cdk_aws_ec2_ceddda9d.VpcProps(**vpc_props)
297
+ if __debug__:
298
+ type_hints = typing.get_type_hints(_typecheckingstub__c8957f6725b32e539ea465d702d48e3d75f146e27128542a202ab4b9152fe115)
299
+ check_type(argname="argument kendra_data_sources_props", value=kendra_data_sources_props, expected_type=type_hints["kendra_data_sources_props"])
300
+ check_type(argname="argument deploy_vpc", value=deploy_vpc, expected_type=type_hints["deploy_vpc"])
301
+ check_type(argname="argument existing_kendra_index_obj", value=existing_kendra_index_obj, expected_type=type_hints["existing_kendra_index_obj"])
302
+ check_type(argname="argument existing_lambda_obj", value=existing_lambda_obj, expected_type=type_hints["existing_lambda_obj"])
303
+ check_type(argname="argument existing_vpc", value=existing_vpc, expected_type=type_hints["existing_vpc"])
304
+ check_type(argname="argument index_id_environment_variable_name", value=index_id_environment_variable_name, expected_type=type_hints["index_id_environment_variable_name"])
305
+ check_type(argname="argument index_permissions", value=index_permissions, expected_type=type_hints["index_permissions"])
306
+ check_type(argname="argument kendra_index_props", value=kendra_index_props, expected_type=type_hints["kendra_index_props"])
307
+ check_type(argname="argument lambda_function_props", value=lambda_function_props, expected_type=type_hints["lambda_function_props"])
308
+ check_type(argname="argument vpc_props", value=vpc_props, expected_type=type_hints["vpc_props"])
309
+ self._values: typing.Dict[builtins.str, typing.Any] = {
310
+ "kendra_data_sources_props": kendra_data_sources_props,
311
+ }
312
+ if deploy_vpc is not None:
313
+ self._values["deploy_vpc"] = deploy_vpc
314
+ if existing_kendra_index_obj is not None:
315
+ self._values["existing_kendra_index_obj"] = existing_kendra_index_obj
316
+ if existing_lambda_obj is not None:
317
+ self._values["existing_lambda_obj"] = existing_lambda_obj
318
+ if existing_vpc is not None:
319
+ self._values["existing_vpc"] = existing_vpc
320
+ if index_id_environment_variable_name is not None:
321
+ self._values["index_id_environment_variable_name"] = index_id_environment_variable_name
322
+ if index_permissions is not None:
323
+ self._values["index_permissions"] = index_permissions
324
+ if kendra_index_props is not None:
325
+ self._values["kendra_index_props"] = kendra_index_props
326
+ if lambda_function_props is not None:
327
+ self._values["lambda_function_props"] = lambda_function_props
328
+ if vpc_props is not None:
329
+ self._values["vpc_props"] = vpc_props
330
+
331
+ @builtins.property
332
+ def kendra_data_sources_props(self) -> typing.List[typing.Any]:
333
+ '''A list of data sources that will provide data to the Kendra index.
334
+
335
+ ?At least 1 must be specified. We will do majority of
336
+ processing for some data sources (S3 crawler initially), but for others the props must be complete (e.g. proper roleArn, etc.)
337
+
338
+ :default: - empty list (no data sources)
339
+ '''
340
+ result = self._values.get("kendra_data_sources_props")
341
+ assert result is not None, "Required property 'kendra_data_sources_props' is missing"
342
+ return typing.cast(typing.List[typing.Any], result)
343
+
344
+ @builtins.property
345
+ def deploy_vpc(self) -> typing.Optional[builtins.bool]:
346
+ '''Whether to deploy a new VPC.
347
+
348
+ :default: - false
349
+ '''
350
+ result = self._values.get("deploy_vpc")
351
+ return typing.cast(typing.Optional[builtins.bool], result)
352
+
353
+ @builtins.property
354
+ def existing_kendra_index_obj(
355
+ self,
356
+ ) -> typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndex]:
357
+ '''Existing instance of a Kendra Index.
358
+
359
+ Providing both this and kendraIndexProps will cause an error.
360
+
361
+ :default: - None
362
+ '''
363
+ result = self._values.get("existing_kendra_index_obj")
364
+ return typing.cast(typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndex], result)
365
+
366
+ @builtins.property
367
+ def existing_lambda_obj(
368
+ self,
369
+ ) -> typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Function]:
370
+ '''Existing instance of Lambda Function object, providing both this and ``lambdaFunctionProps`` will cause an error.
371
+
372
+ :default: - None
373
+ '''
374
+ result = self._values.get("existing_lambda_obj")
375
+ return typing.cast(typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Function], result)
376
+
377
+ @builtins.property
378
+ def existing_vpc(self) -> typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc]:
379
+ '''An existing VPC for the construct to use (construct will NOT create a new VPC in this case).'''
380
+ result = self._values.get("existing_vpc")
381
+ return typing.cast(typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc], result)
382
+
383
+ @builtins.property
384
+ def index_id_environment_variable_name(self) -> typing.Optional[builtins.str]:
385
+ '''Optional Name for the Lambda function environment variable set to the index id for the Kendra index.
386
+
387
+ :default: - KENDRA_INDEX_ID
388
+ '''
389
+ result = self._values.get("index_id_environment_variable_name")
390
+ return typing.cast(typing.Optional[builtins.str], result)
391
+
392
+ @builtins.property
393
+ def index_permissions(self) -> typing.Optional[typing.List[builtins.str]]:
394
+ '''Optional - index permissions to grant to the Lambda function.
395
+
396
+ One or more of the following
397
+ may be specified: ``Read``, ``SubmitFeedback`` and ``Write``. Default is ``["Read", "SubmitFeedback"]``. Read is
398
+ all the operations IAM defines as Read and List. SubmitFeedback is only the SubmitFeedback action. Write is all the
399
+ operations IAM defines as Write and Tag. This functionality may be overridden by providing a specific role arn in lambdaFunctionProps
400
+
401
+ :default: - ["Read", "SubmitFeedback"]
402
+ '''
403
+ result = self._values.get("index_permissions")
404
+ return typing.cast(typing.Optional[typing.List[builtins.str]], result)
405
+
406
+ @builtins.property
407
+ def kendra_index_props(
408
+ self,
409
+ ) -> typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndexProps]:
410
+ '''
411
+ :default: - Optional user provided props to override the default props for the Kendra index. Is this required?
412
+ '''
413
+ result = self._values.get("kendra_index_props")
414
+ return typing.cast(typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndexProps], result)
415
+
416
+ @builtins.property
417
+ def lambda_function_props(
418
+ self,
419
+ ) -> typing.Optional[_aws_cdk_aws_lambda_ceddda9d.FunctionProps]:
420
+ '''User provided props to override the default props for the Lambda function.
421
+
422
+ :default: - Default properties are used.
423
+ '''
424
+ result = self._values.get("lambda_function_props")
425
+ return typing.cast(typing.Optional[_aws_cdk_aws_lambda_ceddda9d.FunctionProps], result)
426
+
427
+ @builtins.property
428
+ def vpc_props(self) -> typing.Optional[_aws_cdk_aws_ec2_ceddda9d.VpcProps]:
429
+ '''Properties to override default properties if deployVpc is true.'''
430
+ result = self._values.get("vpc_props")
431
+ return typing.cast(typing.Optional[_aws_cdk_aws_ec2_ceddda9d.VpcProps], result)
432
+
433
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
434
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
435
+
436
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
437
+ return not (rhs == self)
438
+
439
+ def __repr__(self) -> str:
440
+ return "LambdaToKendraProps(%s)" % ", ".join(
441
+ k + "=" + repr(v) for k, v in self._values.items()
442
+ )
443
+
444
+
445
+ __all__ = [
446
+ "LambdaToKendra",
447
+ "LambdaToKendraProps",
448
+ ]
449
+
450
+ publication.publish()
451
+
452
+ def _typecheckingstub__9da37223ecd15aa48c8fdb15e8ae674033a9aa9395fc3369ba9f24ea9cae4ca1(
453
+ scope: _constructs_77d1e7e8.Construct,
454
+ id: builtins.str,
455
+ *,
456
+ kendra_data_sources_props: typing.Sequence[typing.Any],
457
+ deploy_vpc: typing.Optional[builtins.bool] = None,
458
+ existing_kendra_index_obj: typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndex] = None,
459
+ existing_lambda_obj: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Function] = None,
460
+ existing_vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
461
+ index_id_environment_variable_name: typing.Optional[builtins.str] = None,
462
+ index_permissions: typing.Optional[typing.Sequence[builtins.str]] = None,
463
+ kendra_index_props: typing.Optional[typing.Union[_aws_cdk_aws_kendra_ceddda9d.CfnIndexProps, typing.Dict[builtins.str, typing.Any]]] = None,
464
+ lambda_function_props: typing.Optional[typing.Union[_aws_cdk_aws_lambda_ceddda9d.FunctionProps, typing.Dict[builtins.str, typing.Any]]] = None,
465
+ vpc_props: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.VpcProps, typing.Dict[builtins.str, typing.Any]]] = None,
466
+ ) -> None:
467
+ """Type checking stubs"""
468
+ pass
469
+
470
+ def _typecheckingstub__c8957f6725b32e539ea465d702d48e3d75f146e27128542a202ab4b9152fe115(
471
+ *,
472
+ kendra_data_sources_props: typing.Sequence[typing.Any],
473
+ deploy_vpc: typing.Optional[builtins.bool] = None,
474
+ existing_kendra_index_obj: typing.Optional[_aws_cdk_aws_kendra_ceddda9d.CfnIndex] = None,
475
+ existing_lambda_obj: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Function] = None,
476
+ existing_vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
477
+ index_id_environment_variable_name: typing.Optional[builtins.str] = None,
478
+ index_permissions: typing.Optional[typing.Sequence[builtins.str]] = None,
479
+ kendra_index_props: typing.Optional[typing.Union[_aws_cdk_aws_kendra_ceddda9d.CfnIndexProps, typing.Dict[builtins.str, typing.Any]]] = None,
480
+ lambda_function_props: typing.Optional[typing.Union[_aws_cdk_aws_lambda_ceddda9d.FunctionProps, typing.Dict[builtins.str, typing.Any]]] = None,
481
+ vpc_props: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.VpcProps, typing.Dict[builtins.str, typing.Any]]] = None,
482
+ ) -> None:
483
+ """Type checking stubs"""
484
+ pass
@@ -0,0 +1,28 @@
1
+ import abc
2
+ import builtins
3
+ import datetime
4
+ import enum
5
+ import typing
6
+
7
+ import jsii
8
+ import publication
9
+ import typing_extensions
10
+
11
+ from typeguard import check_type
12
+
13
+ import aws_cdk._jsii
14
+ import aws_solutions_constructs.core._jsii
15
+ import constructs._jsii
16
+
17
+ __jsii_assembly__ = jsii.JSIIAssembly.load(
18
+ "@aws-solutions-constructs/aws-lambda-kendra",
19
+ "2.44.0",
20
+ __name__[0:-6],
21
+ "aws-lambda-kendra@2.44.0.jsii.tgz",
22
+ )
23
+
24
+ __all__ = [
25
+ "__jsii_assembly__",
26
+ ]
27
+
28
+ publication.publish()
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-lambda-kendra
3
+ Version: 2.44.0
4
+ Summary: CDK constructs for defining an interaction between an AWS Lambda function and an existing Amazon Kinesis Firehose Delivery Stream.
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.7
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Typing :: Typed
19
+ Classifier: License :: OSI Approved
20
+ Requires-Python: ~=3.7
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+
24
+ # aws-lambda-kendra module
25
+
26
+ ---
27
+
28
+
29
+ ![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge)
30
+
31
+ > All classes are under active development and subject to non-backward compatible changes or removal in any
32
+ > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model.
33
+ > 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.
34
+
35
+ ---
36
+
37
+
38
+ | **Reference Documentation**: | <span style="font-weight: normal;">https://docs.aws.amazon.com/solutions/latest/constructs/</span> |
39
+ | --- | --- |
40
+
41
+ | **Language** | **Package** |
42
+ | --- | --- |
43
+ | ![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python | `aws_solutions_constructs.aws_lambda_kendra` |
44
+ | ![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript | `@aws-solutions-constructs/aws-lambda-kendra` |
45
+ | ![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java | `software.amazon.awsconstructs.services.lambdakendra` |
46
+
47
+ ## Overview
48
+
49
+ This AWS Solutions Construct implements an AWS Lambda function and Amazon Kendra index with the least privileged permissions.
50
+
51
+ Here is a minimal deployable pattern definition:
52
+
53
+ Typescript
54
+
55
+ ```python
56
+ import { Construct } from 'constructs';
57
+ import { Stack, StackProps, Aws } from 'aws-cdk-lib';
58
+ import { LambdaToKendra } from '@aws-solutions-constructs/aws-lambda-kendra';
59
+ import * as lambda from "aws-cdk-lib/aws-lambda";
60
+ import * as s3 from "aws-cdk-lib/aws-s3";
61
+
62
+ const lambdaProps: lambda.FunctionProps = {
63
+ code: lambda.Code.fromAsset(`lambda`),
64
+ runtime: lambda.Runtime.NODEJS_18_X,
65
+ handler: 'index.handler'
66
+ };
67
+
68
+ new LambdaToKendra(this, 'sample', {
69
+ lambdaFunctionProps: lambdaProps,
70
+ kendraIndexProps: {},
71
+ kendraDataSourceProps: [{
72
+ type: 'S3',
73
+ dataSourceConfiguration: {
74
+ s3Configuration: {
75
+ bucketName: 'your-bucket-name',
76
+ }
77
+ }
78
+ ],
79
+ });
80
+ ```
81
+
82
+ Python
83
+
84
+ ```python
85
+ TBD
86
+ ```
87
+
88
+ Java
89
+
90
+ ```java
91
+ TBD
92
+ ```
93
+
94
+ ## Pattern Construct Props
95
+
96
+ | **Name** | **Type** | **Description** |
97
+ | --- | --- | --- |
98
+ | 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. |
99
+ | lambdaFunctionProps? | [`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html) | User provided props to override the default props for the Lambda function. |
100
+ | kendraIndexProps? | [`kendra.CfnIndexProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Optional user provided props to override the default props for the Kendra index. Providing both these and existingKendraIndexObj is an error. |
101
+ | kendraDataSourcesProps | [`CfnDataSourceProps[]`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html) | 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.) |
102
+ | indexPermissions? | `string[]` | Optional - index permissions to grant to the Lambda function. One or more of the following may be specified: `Read`, `SubmitFeedback` and `Write`. 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 lambdaFunctionProps |
103
+ | existingKendraIndexObj? | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | An existing Kendra index to which the Lambda function will be granted access. Supplying along with kendraIndexProps or kendraDataSourceProps will throw an error. |
104
+ | 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 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, the `deployVpc` property cannot be `true`. This uses `ec2.IVpc` to allow clients to supply VPCs that exist outside the stack using the [`ec2.Vpc.fromLookup()`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html#static-fromwbrlookupscope-id-options) method. |
105
+ | 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 pattern, so any values for those properties supplied here will be overridden. If `deployVpc` is not `true` then this property will be ignored. |
106
+ | 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:<br>- One isolated subnet in each Availability Zone used by the CDK program<br>- `enableDnsHostnames` and `enableDnsSupport` will both be set to true<br>If this property is `true` then `existingVpc` cannot be specified. Defaults to `false`. |
107
+
108
+ ## Pattern Properties
109
+
110
+ | **Name** | **Type** | **Description** |
111
+ | --- | --- | --- |
112
+ | lambdaFunction | [`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html) | Returns an instance of `lambda.Function` managed by the construct |
113
+ | kendraIndex | [`kendra.cfnIndex`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnIndex.html) | Returns an instance of `kendra.cfnIndex` managed by the construct |
114
+ | kendraDataSources | DataSourceProperties[] (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. |
115
+ | lambdaRole | [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html) | The role assumed by the Lambda function |
116
+ | vpc? | [`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) | Returns 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. |
117
+
118
+ interface DataSourceProperties {
119
+ role?: [`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html),
120
+ source: | [`CfnDataSource`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kendra.CfnDataSource.html)
121
+ }
122
+
123
+ ## Lambda Function
124
+
125
+ This pattern requires a lambda function that can access a Kendra index.
126
+
127
+ ## Default settings
128
+
129
+ Out of the box implementation of the Construct without any overrides will set the following defaults:
130
+
131
+ ### AWS Lambda Function
132
+
133
+ * Configure limited privilege access IAM role for Lambda function
134
+ * Enable reusing connections with Keep-Alive for Node.js Lambda function
135
+ * Enable X-Ray Tracing
136
+ * Set Environment Variables
137
+
138
+ * (default) KENDRA_INDEX_ID
139
+ * AWS_NODEJS_CONNECTION_REUSE_ENABLED
140
+
141
+ ### Amazon Kendra Index
142
+
143
+ * Creates Amazon Kendra endpoint in VPC if appropriate
144
+ * Defaults to DEVELOPER_EDITION
145
+
146
+ **Amazon Kendra DataSources**
147
+
148
+ * Sets up correct IAM roles to access data for:
149
+
150
+ * S3 data sources
151
+ * Which others should we support in MLP? https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html
152
+ * Adds each data source to Kendra index
153
+
154
+ ## Architecture
155
+
156
+ ![Architecture Diagram](architecture.png)
157
+
158
+ ---
159
+
160
+
161
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.py
6
+ src/aws_solutions_constructs.aws_lambda_kendra.egg-info/PKG-INFO
7
+ src/aws_solutions_constructs.aws_lambda_kendra.egg-info/SOURCES.txt
8
+ src/aws_solutions_constructs.aws_lambda_kendra.egg-info/dependency_links.txt
9
+ src/aws_solutions_constructs.aws_lambda_kendra.egg-info/requires.txt
10
+ src/aws_solutions_constructs.aws_lambda_kendra.egg-info/top_level.txt
11
+ src/aws_solutions_constructs/aws_lambda_kendra/__init__.py
12
+ src/aws_solutions_constructs/aws_lambda_kendra/py.typed
13
+ src/aws_solutions_constructs/aws_lambda_kendra/_jsii/__init__.py
14
+ src/aws_solutions_constructs/aws_lambda_kendra/_jsii/aws-lambda-kendra@2.44.0.jsii.tgz
@@ -0,0 +1,6 @@
1
+ aws-cdk-lib<3.0.0,>=2.82.0
2
+ aws-solutions-constructs.core==2.44.0
3
+ constructs<11.0.0,>=10.0.0
4
+ jsii<2.0.0,>=1.88.0
5
+ publication>=0.0.3
6
+ typeguard~=2.13.3