aws-solutions-constructs.aws-lambda-dynamodb 2.35.0__tar.gz → 2.98.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.
- aws_solutions_constructs_aws_lambda_dynamodb-2.98.0/PKG-INFO +28 -0
- aws_solutions_constructs_aws_lambda_dynamodb-2.98.0/README.md +1 -0
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/pyproject.toml +2 -2
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/setup.py +7 -9
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/src/aws_solutions_constructs/aws_lambda_dynamodb/__init__.py +36 -148
- aws_solutions_constructs_aws_lambda_dynamodb-2.98.0/src/aws_solutions_constructs/aws_lambda_dynamodb/_jsii/__init__.py +46 -0
- aws_solutions_constructs_aws_lambda_dynamodb-2.98.0/src/aws_solutions_constructs/aws_lambda_dynamodb/_jsii/aws-lambda-dynamodb@2.98.0.jsii.tgz +0 -0
- aws_solutions_constructs_aws_lambda_dynamodb-2.98.0/src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/PKG-INFO +28 -0
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/SOURCES.txt +1 -1
- aws_solutions_constructs_aws_lambda_dynamodb-2.98.0/src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/requires.txt +6 -0
- aws-solutions-constructs.aws-lambda-dynamodb-2.35.0/PKG-INFO +0 -160
- aws-solutions-constructs.aws-lambda-dynamodb-2.35.0/README.md +0 -137
- aws-solutions-constructs.aws-lambda-dynamodb-2.35.0/src/aws_solutions_constructs/aws_lambda_dynamodb/_jsii/__init__.py +0 -28
- aws-solutions-constructs.aws-lambda-dynamodb-2.35.0/src/aws_solutions_constructs/aws_lambda_dynamodb/_jsii/aws-lambda-dynamodb@2.35.0.jsii.tgz +0 -0
- aws-solutions-constructs.aws-lambda-dynamodb-2.35.0/src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/PKG-INFO +0 -160
- aws-solutions-constructs.aws-lambda-dynamodb-2.35.0/src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/requires.txt +0 -6
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/LICENSE +0 -0
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/MANIFEST.in +0 -0
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/setup.cfg +0 -0
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/src/aws_solutions_constructs/aws_lambda_dynamodb/py.typed +0 -0
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/dependency_links.txt +0 -0
- {aws-solutions-constructs.aws-lambda-dynamodb-2.35.0 → aws_solutions_constructs_aws_lambda_dynamodb-2.98.0}/src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: aws-solutions-constructs.aws-lambda-dynamodb
|
|
3
|
+
Version: 2.98.0
|
|
4
|
+
Summary: CDK Constructs for AWS Lambda to AWS DynamoDB integration.
|
|
5
|
+
Home-page: https://github.com/awslabs/aws-solutions-constructs.git
|
|
6
|
+
Author: Amazon Web Services
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: JavaScript
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Classifier: License :: OSI Approved
|
|
18
|
+
Requires-Python: ~=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: aws-cdk-lib<3.0.0,>=2.234.0
|
|
22
|
+
Requires-Dist: aws-solutions-constructs.core==2.98.0
|
|
23
|
+
Requires-Dist: constructs<11.0.0,>=10.0.0
|
|
24
|
+
Requires-Dist: jsii<2.0.0,>=1.119.0
|
|
25
|
+
Requires-Dist: publication>=0.0.3
|
|
26
|
+
Requires-Dist: typeguard<4.3.0,>=2.13.3
|
|
27
|
+
|
|
28
|
+
Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-lambda-dynamodb/README.adoc)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-lambda-dynamodb/README.adoc)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools~=
|
|
2
|
+
requires = ["setuptools~=75.3.2", "build~=1.3.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[tool.pyright]
|
|
6
6
|
defineConstant = { DEBUG = true }
|
|
7
|
-
pythonVersion = "3.
|
|
7
|
+
pythonVersion = "3.9"
|
|
8
8
|
pythonPlatform = "All"
|
|
9
9
|
reportSelfClsParameterName = false
|
|
@@ -5,7 +5,7 @@ kwargs = json.loads(
|
|
|
5
5
|
"""
|
|
6
6
|
{
|
|
7
7
|
"name": "aws-solutions-constructs.aws-lambda-dynamodb",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.98.0",
|
|
9
9
|
"description": "CDK Constructs for AWS Lambda to AWS DynamoDB integration.",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"url": "https://github.com/awslabs/aws-solutions-constructs.git",
|
|
@@ -26,28 +26,26 @@ kwargs = json.loads(
|
|
|
26
26
|
],
|
|
27
27
|
"package_data": {
|
|
28
28
|
"aws_solutions_constructs.aws_lambda_dynamodb._jsii": [
|
|
29
|
-
"aws-lambda-dynamodb@2.
|
|
29
|
+
"aws-lambda-dynamodb@2.98.0.jsii.tgz"
|
|
30
30
|
],
|
|
31
31
|
"aws_solutions_constructs.aws_lambda_dynamodb": [
|
|
32
32
|
"py.typed"
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
|
-
"python_requires": "~=3.
|
|
35
|
+
"python_requires": "~=3.9",
|
|
36
36
|
"install_requires": [
|
|
37
|
-
"aws-cdk-lib>=2.
|
|
38
|
-
"aws-solutions-constructs.core==2.
|
|
37
|
+
"aws-cdk-lib>=2.234.0, <3.0.0",
|
|
38
|
+
"aws-solutions-constructs.core==2.98.0",
|
|
39
39
|
"constructs>=10.0.0, <11.0.0",
|
|
40
|
-
"jsii>=1.
|
|
40
|
+
"jsii>=1.119.0, <2.0.0",
|
|
41
41
|
"publication>=0.0.3",
|
|
42
|
-
"typeguard
|
|
42
|
+
"typeguard>=2.13.3,<4.3.0"
|
|
43
43
|
],
|
|
44
44
|
"classifiers": [
|
|
45
45
|
"Intended Audience :: Developers",
|
|
46
46
|
"Operating System :: OS Independent",
|
|
47
47
|
"Programming Language :: JavaScript",
|
|
48
48
|
"Programming Language :: Python :: 3 :: Only",
|
|
49
|
-
"Programming Language :: Python :: 3.7",
|
|
50
|
-
"Programming Language :: Python :: 3.8",
|
|
51
49
|
"Programming Language :: Python :: 3.9",
|
|
52
50
|
"Programming Language :: Python :: 3.10",
|
|
53
51
|
"Programming Language :: Python :: 3.11",
|
|
@@ -1,142 +1,9 @@
|
|
|
1
|
+
r'''
|
|
2
|
+
Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-lambda-dynamodb/README.adoc)
|
|
1
3
|
'''
|
|
2
|
-
|
|
4
|
+
from pkgutil import extend_path
|
|
5
|
+
__path__ = extend_path(__path__, __name__)
|
|
3
6
|
|
|
4
|
-
<!--BEGIN STABILITY BANNER-->---
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-

|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
<!--END STABILITY BANNER-->
|
|
11
|
-
|
|
12
|
-
| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|
|
13
|
-
|:-------------|:-------------|
|
|
14
|
-
|
|
15
|
-
<div style="height:8px"></div>
|
|
16
|
-
|
|
17
|
-
| **Language** | **Package** |
|
|
18
|
-
|:-------------|-----------------|
|
|
19
|
-
| Python|`aws_solutions_constructs.aws_lambda_dynamodb`|
|
|
20
|
-
| Typescript|`@aws-solutions-constructs/aws-lambda-dynamodb`|
|
|
21
|
-
| Java|`software.amazon.awsconstructs.services.lambdadynamodb`|
|
|
22
|
-
|
|
23
|
-
## Overview
|
|
24
|
-
|
|
25
|
-
This AWS Solutions Construct implements the AWS Lambda function and Amazon DynamoDB table with the least privileged permissions.
|
|
26
|
-
|
|
27
|
-
Here is a minimal deployable pattern definition:
|
|
28
|
-
|
|
29
|
-
Typescript
|
|
30
|
-
|
|
31
|
-
```python
|
|
32
|
-
import { Construct } from 'constructs';
|
|
33
|
-
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
34
|
-
import { LambdaToDynamoDBProps, LambdaToDynamoDB } from '@aws-solutions-constructs/aws-lambda-dynamodb';
|
|
35
|
-
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
36
|
-
|
|
37
|
-
const constructProps: LambdaToDynamoDBProps = {
|
|
38
|
-
lambdaFunctionProps: {
|
|
39
|
-
code: lambda.Code.fromAsset(`lambda`),
|
|
40
|
-
runtime: lambda.Runtime.NODEJS_14_X,
|
|
41
|
-
handler: 'index.handler'
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
new LambdaToDynamoDB(this, 'test-lambda-dynamodb-stack', constructProps);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Python
|
|
49
|
-
|
|
50
|
-
```python
|
|
51
|
-
from aws_solutions_constructs.aws_lambda_dynamodb import LambdaToDynamoDBProps, LambdaToDynamoDB
|
|
52
|
-
from aws_cdk import (
|
|
53
|
-
aws_lambda as _lambda,
|
|
54
|
-
Stack
|
|
55
|
-
)
|
|
56
|
-
from constructs import Construct
|
|
57
|
-
|
|
58
|
-
LambdaToDynamoDB(self, 'test_lambda_dynamodb_stack',
|
|
59
|
-
lambda_function_props=_lambda.FunctionProps(
|
|
60
|
-
code=_lambda.Code.from_asset(
|
|
61
|
-
'lambda'),
|
|
62
|
-
runtime=_lambda.Runtime.PYTHON_3_9,
|
|
63
|
-
handler='index.handler'
|
|
64
|
-
))
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Java
|
|
68
|
-
|
|
69
|
-
```java
|
|
70
|
-
import software.constructs.Construct;
|
|
71
|
-
|
|
72
|
-
import software.amazon.awscdk.Stack;
|
|
73
|
-
import software.amazon.awscdk.StackProps;
|
|
74
|
-
import software.amazon.awscdk.services.lambda.*;
|
|
75
|
-
import software.amazon.awscdk.services.lambda.Runtime;
|
|
76
|
-
import software.amazon.awsconstructs.services.lambdadynamodb.*;
|
|
77
|
-
|
|
78
|
-
new LambdaToDynamoDB(this, "test_lambda_dynamodb_stack", new LambdaToDynamoDBProps.Builder()
|
|
79
|
-
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
80
|
-
.runtime(Runtime.NODEJS_14_X)
|
|
81
|
-
.code(Code.fromAsset("lambda"))
|
|
82
|
-
.handler("index.handler")
|
|
83
|
-
.build())
|
|
84
|
-
.build());
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Pattern Construct Props
|
|
88
|
-
|
|
89
|
-
| **Name** | **Type** | **Description** |
|
|
90
|
-
|:-------------|:----------------|-----------------|
|
|
91
|
-
|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.|
|
|
92
|
-
|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.|
|
|
93
|
-
|dynamoTableProps?|[`dynamodb.TableProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.TableProps.html)|Optional user provided props to override the default props for DynamoDB Table|
|
|
94
|
-
|existingTableObj?|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Existing instance of DynamoDB table object, providing both this and `dynamoTableProps` will cause an error.|
|
|
95
|
-
|tablePermissions?|`string`|Optional table permissions to grant to the Lambda function. One of the following may be specified: `All`, `Read`, `ReadWrite`, `Write`.|
|
|
96
|
-
|tableEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the DynamoDB table. Default: DDB_TABLE_NAME |
|
|
97
|
-
|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 and a Gateway Endpoint will be created in the VPC for Amazon DynamoDB. 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.|
|
|
98
|
-
|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 overrriden. If `deployVpc` is not `true` then this property will be ignored.|
|
|
99
|
-
|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`.|
|
|
100
|
-
|
|
101
|
-
## Pattern Properties
|
|
102
|
-
|
|
103
|
-
| **Name** | **Type** | **Description** |
|
|
104
|
-
|:-------------|:----------------|-----------------|
|
|
105
|
-
|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 created by the construct|
|
|
106
|
-
|dynamoTable|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Returns an instance of dynamodb.Table created by the construct|
|
|
107
|
-
|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.|
|
|
108
|
-
|
|
109
|
-
## Default settings
|
|
110
|
-
|
|
111
|
-
Out of the box implementation of the Construct without any override will set the following defaults:
|
|
112
|
-
|
|
113
|
-
### AWS Lambda Function
|
|
114
|
-
|
|
115
|
-
* Configure limited privilege access IAM role for Lambda function
|
|
116
|
-
* Enable reusing connections with Keep-Alive for NodeJs Lambda function
|
|
117
|
-
* Enable X-Ray Tracing
|
|
118
|
-
* Set Environment Variables
|
|
119
|
-
|
|
120
|
-
* (default) DDB_TABLE_NAME
|
|
121
|
-
* AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
|
|
122
|
-
|
|
123
|
-
### Amazon DynamoDB Table
|
|
124
|
-
|
|
125
|
-
* Set the billing mode for DynamoDB Table to On-Demand (Pay per request)
|
|
126
|
-
* Enable server-side encryption for DynamoDB Table using AWS managed KMS Key
|
|
127
|
-
* Creates a partition key called 'id' for DynamoDB Table
|
|
128
|
-
* Retain the Table when deleting the CloudFormation stack
|
|
129
|
-
* Enable continuous backups and point-in-time recovery
|
|
130
|
-
|
|
131
|
-
## Architecture
|
|
132
|
-
|
|
133
|
-

|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
139
|
-
'''
|
|
140
7
|
import abc
|
|
141
8
|
import builtins
|
|
142
9
|
import datetime
|
|
@@ -147,7 +14,22 @@ import jsii
|
|
|
147
14
|
import publication
|
|
148
15
|
import typing_extensions
|
|
149
16
|
|
|
150
|
-
|
|
17
|
+
import typeguard
|
|
18
|
+
from importlib.metadata import version as _metadata_package_version
|
|
19
|
+
TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
|
|
20
|
+
|
|
21
|
+
def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
|
|
22
|
+
if TYPEGUARD_MAJOR_VERSION <= 2:
|
|
23
|
+
return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
|
|
24
|
+
else:
|
|
25
|
+
if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
|
|
26
|
+
pass
|
|
27
|
+
else:
|
|
28
|
+
if TYPEGUARD_MAJOR_VERSION == 3:
|
|
29
|
+
typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
|
|
30
|
+
typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
|
|
31
|
+
else:
|
|
32
|
+
typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
|
|
151
33
|
|
|
152
34
|
from ._jsii import *
|
|
153
35
|
|
|
@@ -181,11 +63,11 @@ class LambdaToDynamoDB(
|
|
|
181
63
|
:param scope: - represents the scope for all the resources.
|
|
182
64
|
:param id: - this is a a scope-unique id.
|
|
183
65
|
:param deploy_vpc: Whether to deploy a new VPC. Default: - false
|
|
184
|
-
:param dynamo_table_props: Optional user provided props to override the default props. Default: -
|
|
185
|
-
:param existing_lambda_obj:
|
|
66
|
+
:param dynamo_table_props: Optional user provided props to override the default props for the DynamoDB Table. Providing both this and ``existingTableInterface`` causes an error. Default: - Partition key ID: string
|
|
67
|
+
:param existing_lambda_obj: Optional - instance of an existing Lambda Function object, providing both this and ``lambdaFunctionProps`` will cause an error. Default: - None
|
|
186
68
|
:param existing_table_obj: Existing instance of DynamoDB table object, providing both this and ``dynamoTableProps`` will cause an error. Default: - None
|
|
187
69
|
:param existing_vpc: An existing VPC for the construct to use (construct will NOT create a new VPC in this case).
|
|
188
|
-
:param lambda_function_props:
|
|
70
|
+
:param lambda_function_props: Optional - user provided props to override the default props for the Lambda function. Providing both this and ``existingLambdaObj`` causes an error. Default: - Default props are used
|
|
189
71
|
:param table_environment_variable_name: Optional Name for the Lambda function environment variable set to the name of the DynamoDB table. Default: - DDB_TABLE_NAME
|
|
190
72
|
:param table_permissions: Optional table permissions to grant to the Lambda function. One of the following may be specified: "All", "Read", "ReadWrite", "Write". Default: - Read/write access is given to the Lambda function if no value is specified.
|
|
191
73
|
:param vpc_props: Properties to override default properties if deployVpc is true.
|
|
@@ -259,11 +141,11 @@ class LambdaToDynamoDBProps:
|
|
|
259
141
|
) -> None:
|
|
260
142
|
'''
|
|
261
143
|
:param deploy_vpc: Whether to deploy a new VPC. Default: - false
|
|
262
|
-
:param dynamo_table_props: Optional user provided props to override the default props. Default: -
|
|
263
|
-
:param existing_lambda_obj:
|
|
144
|
+
:param dynamo_table_props: Optional user provided props to override the default props for the DynamoDB Table. Providing both this and ``existingTableInterface`` causes an error. Default: - Partition key ID: string
|
|
145
|
+
:param existing_lambda_obj: Optional - instance of an existing Lambda Function object, providing both this and ``lambdaFunctionProps`` will cause an error. Default: - None
|
|
264
146
|
:param existing_table_obj: Existing instance of DynamoDB table object, providing both this and ``dynamoTableProps`` will cause an error. Default: - None
|
|
265
147
|
:param existing_vpc: An existing VPC for the construct to use (construct will NOT create a new VPC in this case).
|
|
266
|
-
:param lambda_function_props:
|
|
148
|
+
:param lambda_function_props: Optional - user provided props to override the default props for the Lambda function. Providing both this and ``existingLambdaObj`` causes an error. Default: - Default props are used
|
|
267
149
|
:param table_environment_variable_name: Optional Name for the Lambda function environment variable set to the name of the DynamoDB table. Default: - DDB_TABLE_NAME
|
|
268
150
|
:param table_permissions: Optional table permissions to grant to the Lambda function. One of the following may be specified: "All", "Read", "ReadWrite", "Write". Default: - Read/write access is given to the Lambda function if no value is specified.
|
|
269
151
|
:param vpc_props: Properties to override default properties if deployVpc is true.
|
|
@@ -320,9 +202,12 @@ class LambdaToDynamoDBProps:
|
|
|
320
202
|
def dynamo_table_props(
|
|
321
203
|
self,
|
|
322
204
|
) -> typing.Optional[_aws_cdk_aws_dynamodb_ceddda9d.TableProps]:
|
|
323
|
-
'''Optional user provided props to override the default props.
|
|
205
|
+
'''Optional user provided props to override the default props for the DynamoDB Table.
|
|
324
206
|
|
|
325
|
-
|
|
207
|
+
Providing both this and
|
|
208
|
+
``existingTableInterface`` causes an error.
|
|
209
|
+
|
|
210
|
+
:default: - Partition key ID: string
|
|
326
211
|
'''
|
|
327
212
|
result = self._values.get("dynamo_table_props")
|
|
328
213
|
return typing.cast(typing.Optional[_aws_cdk_aws_dynamodb_ceddda9d.TableProps], result)
|
|
@@ -331,7 +216,7 @@ class LambdaToDynamoDBProps:
|
|
|
331
216
|
def existing_lambda_obj(
|
|
332
217
|
self,
|
|
333
218
|
) -> typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Function]:
|
|
334
|
-
'''
|
|
219
|
+
'''Optional - instance of an existing Lambda Function object, providing both this and ``lambdaFunctionProps`` will cause an error.
|
|
335
220
|
|
|
336
221
|
:default: - None
|
|
337
222
|
'''
|
|
@@ -359,7 +244,10 @@ class LambdaToDynamoDBProps:
|
|
|
359
244
|
def lambda_function_props(
|
|
360
245
|
self,
|
|
361
246
|
) -> typing.Optional[_aws_cdk_aws_lambda_ceddda9d.FunctionProps]:
|
|
362
|
-
'''
|
|
247
|
+
'''Optional - user provided props to override the default props for the Lambda function.
|
|
248
|
+
|
|
249
|
+
Providing both this and ``existingLambdaObj``
|
|
250
|
+
causes an error.
|
|
363
251
|
|
|
364
252
|
:default: - Default props are used
|
|
365
253
|
'''
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from pkgutil import extend_path
|
|
2
|
+
__path__ = extend_path(__path__, __name__)
|
|
3
|
+
|
|
4
|
+
import abc
|
|
5
|
+
import builtins
|
|
6
|
+
import datetime
|
|
7
|
+
import enum
|
|
8
|
+
import typing
|
|
9
|
+
|
|
10
|
+
import jsii
|
|
11
|
+
import publication
|
|
12
|
+
import typing_extensions
|
|
13
|
+
|
|
14
|
+
import typeguard
|
|
15
|
+
from importlib.metadata import version as _metadata_package_version
|
|
16
|
+
TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
|
|
17
|
+
|
|
18
|
+
def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
|
|
19
|
+
if TYPEGUARD_MAJOR_VERSION <= 2:
|
|
20
|
+
return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
|
|
21
|
+
else:
|
|
22
|
+
if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
|
|
23
|
+
pass
|
|
24
|
+
else:
|
|
25
|
+
if TYPEGUARD_MAJOR_VERSION == 3:
|
|
26
|
+
typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
|
|
27
|
+
typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
|
|
28
|
+
else:
|
|
29
|
+
typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
|
|
30
|
+
|
|
31
|
+
import aws_cdk._jsii
|
|
32
|
+
import aws_solutions_constructs.core._jsii
|
|
33
|
+
import constructs._jsii
|
|
34
|
+
|
|
35
|
+
__jsii_assembly__ = jsii.JSIIAssembly.load(
|
|
36
|
+
"@aws-solutions-constructs/aws-lambda-dynamodb",
|
|
37
|
+
"2.98.0",
|
|
38
|
+
__name__[0:-6],
|
|
39
|
+
"aws-lambda-dynamodb@2.98.0.jsii.tgz",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"__jsii_assembly__",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
publication.publish()
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: aws-solutions-constructs.aws-lambda-dynamodb
|
|
3
|
+
Version: 2.98.0
|
|
4
|
+
Summary: CDK Constructs for AWS Lambda to AWS DynamoDB integration.
|
|
5
|
+
Home-page: https://github.com/awslabs/aws-solutions-constructs.git
|
|
6
|
+
Author: Amazon Web Services
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: JavaScript
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Classifier: License :: OSI Approved
|
|
18
|
+
Requires-Python: ~=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: aws-cdk-lib<3.0.0,>=2.234.0
|
|
22
|
+
Requires-Dist: aws-solutions-constructs.core==2.98.0
|
|
23
|
+
Requires-Dist: constructs<11.0.0,>=10.0.0
|
|
24
|
+
Requires-Dist: jsii<2.0.0,>=1.119.0
|
|
25
|
+
Requires-Dist: publication>=0.0.3
|
|
26
|
+
Requires-Dist: typeguard<4.3.0,>=2.13.3
|
|
27
|
+
|
|
28
|
+
Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-lambda-dynamodb/README.adoc)
|
|
@@ -11,4 +11,4 @@ src/aws_solutions_constructs.aws_lambda_dynamodb.egg-info/top_level.txt
|
|
|
11
11
|
src/aws_solutions_constructs/aws_lambda_dynamodb/__init__.py
|
|
12
12
|
src/aws_solutions_constructs/aws_lambda_dynamodb/py.typed
|
|
13
13
|
src/aws_solutions_constructs/aws_lambda_dynamodb/_jsii/__init__.py
|
|
14
|
-
src/aws_solutions_constructs/aws_lambda_dynamodb/_jsii/aws-lambda-dynamodb@2.
|
|
14
|
+
src/aws_solutions_constructs/aws_lambda_dynamodb/_jsii/aws-lambda-dynamodb@2.98.0.jsii.tgz
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: aws-solutions-constructs.aws-lambda-dynamodb
|
|
3
|
-
Version: 2.35.0
|
|
4
|
-
Summary: CDK Constructs for AWS Lambda to AWS DynamoDB integration.
|
|
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-dynamodb module
|
|
25
|
-
|
|
26
|
-
<!--BEGIN STABILITY BANNER-->---
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
<!--END STABILITY BANNER-->
|
|
33
|
-
|
|
34
|
-
| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|
|
35
|
-
|:-------------|:-------------|
|
|
36
|
-
|
|
37
|
-
<div style="height:8px"></div>
|
|
38
|
-
|
|
39
|
-
| **Language** | **Package** |
|
|
40
|
-
|:-------------|-----------------|
|
|
41
|
-
| Python|`aws_solutions_constructs.aws_lambda_dynamodb`|
|
|
42
|
-
| Typescript|`@aws-solutions-constructs/aws-lambda-dynamodb`|
|
|
43
|
-
| Java|`software.amazon.awsconstructs.services.lambdadynamodb`|
|
|
44
|
-
|
|
45
|
-
## Overview
|
|
46
|
-
|
|
47
|
-
This AWS Solutions Construct implements the AWS Lambda function and Amazon DynamoDB table with the least privileged permissions.
|
|
48
|
-
|
|
49
|
-
Here is a minimal deployable pattern definition:
|
|
50
|
-
|
|
51
|
-
Typescript
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
import { Construct } from 'constructs';
|
|
55
|
-
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
56
|
-
import { LambdaToDynamoDBProps, LambdaToDynamoDB } from '@aws-solutions-constructs/aws-lambda-dynamodb';
|
|
57
|
-
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
58
|
-
|
|
59
|
-
const constructProps: LambdaToDynamoDBProps = {
|
|
60
|
-
lambdaFunctionProps: {
|
|
61
|
-
code: lambda.Code.fromAsset(`lambda`),
|
|
62
|
-
runtime: lambda.Runtime.NODEJS_14_X,
|
|
63
|
-
handler: 'index.handler'
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
new LambdaToDynamoDB(this, 'test-lambda-dynamodb-stack', constructProps);
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Python
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from aws_solutions_constructs.aws_lambda_dynamodb import LambdaToDynamoDBProps, LambdaToDynamoDB
|
|
74
|
-
from aws_cdk import (
|
|
75
|
-
aws_lambda as _lambda,
|
|
76
|
-
Stack
|
|
77
|
-
)
|
|
78
|
-
from constructs import Construct
|
|
79
|
-
|
|
80
|
-
LambdaToDynamoDB(self, 'test_lambda_dynamodb_stack',
|
|
81
|
-
lambda_function_props=_lambda.FunctionProps(
|
|
82
|
-
code=_lambda.Code.from_asset(
|
|
83
|
-
'lambda'),
|
|
84
|
-
runtime=_lambda.Runtime.PYTHON_3_9,
|
|
85
|
-
handler='index.handler'
|
|
86
|
-
))
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Java
|
|
90
|
-
|
|
91
|
-
```java
|
|
92
|
-
import software.constructs.Construct;
|
|
93
|
-
|
|
94
|
-
import software.amazon.awscdk.Stack;
|
|
95
|
-
import software.amazon.awscdk.StackProps;
|
|
96
|
-
import software.amazon.awscdk.services.lambda.*;
|
|
97
|
-
import software.amazon.awscdk.services.lambda.Runtime;
|
|
98
|
-
import software.amazon.awsconstructs.services.lambdadynamodb.*;
|
|
99
|
-
|
|
100
|
-
new LambdaToDynamoDB(this, "test_lambda_dynamodb_stack", new LambdaToDynamoDBProps.Builder()
|
|
101
|
-
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
102
|
-
.runtime(Runtime.NODEJS_14_X)
|
|
103
|
-
.code(Code.fromAsset("lambda"))
|
|
104
|
-
.handler("index.handler")
|
|
105
|
-
.build())
|
|
106
|
-
.build());
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Pattern Construct Props
|
|
110
|
-
|
|
111
|
-
| **Name** | **Type** | **Description** |
|
|
112
|
-
|:-------------|:----------------|-----------------|
|
|
113
|
-
|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.|
|
|
114
|
-
|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.|
|
|
115
|
-
|dynamoTableProps?|[`dynamodb.TableProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.TableProps.html)|Optional user provided props to override the default props for DynamoDB Table|
|
|
116
|
-
|existingTableObj?|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Existing instance of DynamoDB table object, providing both this and `dynamoTableProps` will cause an error.|
|
|
117
|
-
|tablePermissions?|`string`|Optional table permissions to grant to the Lambda function. One of the following may be specified: `All`, `Read`, `ReadWrite`, `Write`.|
|
|
118
|
-
|tableEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the DynamoDB table. Default: DDB_TABLE_NAME |
|
|
119
|
-
|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 and a Gateway Endpoint will be created in the VPC for Amazon DynamoDB. 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.|
|
|
120
|
-
|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 overrriden. If `deployVpc` is not `true` then this property will be ignored.|
|
|
121
|
-
|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`.|
|
|
122
|
-
|
|
123
|
-
## Pattern Properties
|
|
124
|
-
|
|
125
|
-
| **Name** | **Type** | **Description** |
|
|
126
|
-
|:-------------|:----------------|-----------------|
|
|
127
|
-
|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 created by the construct|
|
|
128
|
-
|dynamoTable|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Returns an instance of dynamodb.Table created by the construct|
|
|
129
|
-
|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.|
|
|
130
|
-
|
|
131
|
-
## Default settings
|
|
132
|
-
|
|
133
|
-
Out of the box implementation of the Construct without any override will set the following defaults:
|
|
134
|
-
|
|
135
|
-
### AWS Lambda Function
|
|
136
|
-
|
|
137
|
-
* Configure limited privilege access IAM role for Lambda function
|
|
138
|
-
* Enable reusing connections with Keep-Alive for NodeJs Lambda function
|
|
139
|
-
* Enable X-Ray Tracing
|
|
140
|
-
* Set Environment Variables
|
|
141
|
-
|
|
142
|
-
* (default) DDB_TABLE_NAME
|
|
143
|
-
* AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
|
|
144
|
-
|
|
145
|
-
### Amazon DynamoDB Table
|
|
146
|
-
|
|
147
|
-
* Set the billing mode for DynamoDB Table to On-Demand (Pay per request)
|
|
148
|
-
* Enable server-side encryption for DynamoDB Table using AWS managed KMS Key
|
|
149
|
-
* Creates a partition key called 'id' for DynamoDB Table
|
|
150
|
-
* Retain the Table when deleting the CloudFormation stack
|
|
151
|
-
* Enable continuous backups and point-in-time recovery
|
|
152
|
-
|
|
153
|
-
## Architecture
|
|
154
|
-
|
|
155
|
-

|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# aws-lambda-dynamodb module
|
|
2
|
-
|
|
3
|
-
<!--BEGIN STABILITY BANNER-->---
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
<!--END STABILITY BANNER-->
|
|
10
|
-
|
|
11
|
-
| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|
|
12
|
-
|:-------------|:-------------|
|
|
13
|
-
|
|
14
|
-
<div style="height:8px"></div>
|
|
15
|
-
|
|
16
|
-
| **Language** | **Package** |
|
|
17
|
-
|:-------------|-----------------|
|
|
18
|
-
| Python|`aws_solutions_constructs.aws_lambda_dynamodb`|
|
|
19
|
-
| Typescript|`@aws-solutions-constructs/aws-lambda-dynamodb`|
|
|
20
|
-
| Java|`software.amazon.awsconstructs.services.lambdadynamodb`|
|
|
21
|
-
|
|
22
|
-
## Overview
|
|
23
|
-
|
|
24
|
-
This AWS Solutions Construct implements the AWS Lambda function and Amazon DynamoDB table with the least privileged permissions.
|
|
25
|
-
|
|
26
|
-
Here is a minimal deployable pattern definition:
|
|
27
|
-
|
|
28
|
-
Typescript
|
|
29
|
-
|
|
30
|
-
```python
|
|
31
|
-
import { Construct } from 'constructs';
|
|
32
|
-
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
33
|
-
import { LambdaToDynamoDBProps, LambdaToDynamoDB } from '@aws-solutions-constructs/aws-lambda-dynamodb';
|
|
34
|
-
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
35
|
-
|
|
36
|
-
const constructProps: LambdaToDynamoDBProps = {
|
|
37
|
-
lambdaFunctionProps: {
|
|
38
|
-
code: lambda.Code.fromAsset(`lambda`),
|
|
39
|
-
runtime: lambda.Runtime.NODEJS_14_X,
|
|
40
|
-
handler: 'index.handler'
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
new LambdaToDynamoDB(this, 'test-lambda-dynamodb-stack', constructProps);
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Python
|
|
48
|
-
|
|
49
|
-
```python
|
|
50
|
-
from aws_solutions_constructs.aws_lambda_dynamodb import LambdaToDynamoDBProps, LambdaToDynamoDB
|
|
51
|
-
from aws_cdk import (
|
|
52
|
-
aws_lambda as _lambda,
|
|
53
|
-
Stack
|
|
54
|
-
)
|
|
55
|
-
from constructs import Construct
|
|
56
|
-
|
|
57
|
-
LambdaToDynamoDB(self, 'test_lambda_dynamodb_stack',
|
|
58
|
-
lambda_function_props=_lambda.FunctionProps(
|
|
59
|
-
code=_lambda.Code.from_asset(
|
|
60
|
-
'lambda'),
|
|
61
|
-
runtime=_lambda.Runtime.PYTHON_3_9,
|
|
62
|
-
handler='index.handler'
|
|
63
|
-
))
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Java
|
|
67
|
-
|
|
68
|
-
```java
|
|
69
|
-
import software.constructs.Construct;
|
|
70
|
-
|
|
71
|
-
import software.amazon.awscdk.Stack;
|
|
72
|
-
import software.amazon.awscdk.StackProps;
|
|
73
|
-
import software.amazon.awscdk.services.lambda.*;
|
|
74
|
-
import software.amazon.awscdk.services.lambda.Runtime;
|
|
75
|
-
import software.amazon.awsconstructs.services.lambdadynamodb.*;
|
|
76
|
-
|
|
77
|
-
new LambdaToDynamoDB(this, "test_lambda_dynamodb_stack", new LambdaToDynamoDBProps.Builder()
|
|
78
|
-
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
79
|
-
.runtime(Runtime.NODEJS_14_X)
|
|
80
|
-
.code(Code.fromAsset("lambda"))
|
|
81
|
-
.handler("index.handler")
|
|
82
|
-
.build())
|
|
83
|
-
.build());
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Pattern Construct Props
|
|
87
|
-
|
|
88
|
-
| **Name** | **Type** | **Description** |
|
|
89
|
-
|:-------------|:----------------|-----------------|
|
|
90
|
-
|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.|
|
|
91
|
-
|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.|
|
|
92
|
-
|dynamoTableProps?|[`dynamodb.TableProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.TableProps.html)|Optional user provided props to override the default props for DynamoDB Table|
|
|
93
|
-
|existingTableObj?|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Existing instance of DynamoDB table object, providing both this and `dynamoTableProps` will cause an error.|
|
|
94
|
-
|tablePermissions?|`string`|Optional table permissions to grant to the Lambda function. One of the following may be specified: `All`, `Read`, `ReadWrite`, `Write`.|
|
|
95
|
-
|tableEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the DynamoDB table. Default: DDB_TABLE_NAME |
|
|
96
|
-
|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 and a Gateway Endpoint will be created in the VPC for Amazon DynamoDB. 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.|
|
|
97
|
-
|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 overrriden. If `deployVpc` is not `true` then this property will be ignored.|
|
|
98
|
-
|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`.|
|
|
99
|
-
|
|
100
|
-
## Pattern Properties
|
|
101
|
-
|
|
102
|
-
| **Name** | **Type** | **Description** |
|
|
103
|
-
|:-------------|:----------------|-----------------|
|
|
104
|
-
|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 created by the construct|
|
|
105
|
-
|dynamoTable|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Returns an instance of dynamodb.Table created by the construct|
|
|
106
|
-
|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.|
|
|
107
|
-
|
|
108
|
-
## Default settings
|
|
109
|
-
|
|
110
|
-
Out of the box implementation of the Construct without any override will set the following defaults:
|
|
111
|
-
|
|
112
|
-
### AWS Lambda Function
|
|
113
|
-
|
|
114
|
-
* Configure limited privilege access IAM role for Lambda function
|
|
115
|
-
* Enable reusing connections with Keep-Alive for NodeJs Lambda function
|
|
116
|
-
* Enable X-Ray Tracing
|
|
117
|
-
* Set Environment Variables
|
|
118
|
-
|
|
119
|
-
* (default) DDB_TABLE_NAME
|
|
120
|
-
* AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
|
|
121
|
-
|
|
122
|
-
### Amazon DynamoDB Table
|
|
123
|
-
|
|
124
|
-
* Set the billing mode for DynamoDB Table to On-Demand (Pay per request)
|
|
125
|
-
* Enable server-side encryption for DynamoDB Table using AWS managed KMS Key
|
|
126
|
-
* Creates a partition key called 'id' for DynamoDB Table
|
|
127
|
-
* Retain the Table when deleting the CloudFormation stack
|
|
128
|
-
* Enable continuous backups and point-in-time recovery
|
|
129
|
-
|
|
130
|
-
## Architecture
|
|
131
|
-
|
|
132
|
-

|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -1,28 +0,0 @@
|
|
|
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-dynamodb",
|
|
19
|
-
"2.35.0",
|
|
20
|
-
__name__[0:-6],
|
|
21
|
-
"aws-lambda-dynamodb@2.35.0.jsii.tgz",
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
__all__ = [
|
|
25
|
-
"__jsii_assembly__",
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
publication.publish()
|
|
Binary file
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: aws-solutions-constructs.aws-lambda-dynamodb
|
|
3
|
-
Version: 2.35.0
|
|
4
|
-
Summary: CDK Constructs for AWS Lambda to AWS DynamoDB integration.
|
|
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-dynamodb module
|
|
25
|
-
|
|
26
|
-
<!--BEGIN STABILITY BANNER-->---
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
<!--END STABILITY BANNER-->
|
|
33
|
-
|
|
34
|
-
| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|
|
35
|
-
|:-------------|:-------------|
|
|
36
|
-
|
|
37
|
-
<div style="height:8px"></div>
|
|
38
|
-
|
|
39
|
-
| **Language** | **Package** |
|
|
40
|
-
|:-------------|-----------------|
|
|
41
|
-
| Python|`aws_solutions_constructs.aws_lambda_dynamodb`|
|
|
42
|
-
| Typescript|`@aws-solutions-constructs/aws-lambda-dynamodb`|
|
|
43
|
-
| Java|`software.amazon.awsconstructs.services.lambdadynamodb`|
|
|
44
|
-
|
|
45
|
-
## Overview
|
|
46
|
-
|
|
47
|
-
This AWS Solutions Construct implements the AWS Lambda function and Amazon DynamoDB table with the least privileged permissions.
|
|
48
|
-
|
|
49
|
-
Here is a minimal deployable pattern definition:
|
|
50
|
-
|
|
51
|
-
Typescript
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
import { Construct } from 'constructs';
|
|
55
|
-
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
56
|
-
import { LambdaToDynamoDBProps, LambdaToDynamoDB } from '@aws-solutions-constructs/aws-lambda-dynamodb';
|
|
57
|
-
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
58
|
-
|
|
59
|
-
const constructProps: LambdaToDynamoDBProps = {
|
|
60
|
-
lambdaFunctionProps: {
|
|
61
|
-
code: lambda.Code.fromAsset(`lambda`),
|
|
62
|
-
runtime: lambda.Runtime.NODEJS_14_X,
|
|
63
|
-
handler: 'index.handler'
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
new LambdaToDynamoDB(this, 'test-lambda-dynamodb-stack', constructProps);
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Python
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from aws_solutions_constructs.aws_lambda_dynamodb import LambdaToDynamoDBProps, LambdaToDynamoDB
|
|
74
|
-
from aws_cdk import (
|
|
75
|
-
aws_lambda as _lambda,
|
|
76
|
-
Stack
|
|
77
|
-
)
|
|
78
|
-
from constructs import Construct
|
|
79
|
-
|
|
80
|
-
LambdaToDynamoDB(self, 'test_lambda_dynamodb_stack',
|
|
81
|
-
lambda_function_props=_lambda.FunctionProps(
|
|
82
|
-
code=_lambda.Code.from_asset(
|
|
83
|
-
'lambda'),
|
|
84
|
-
runtime=_lambda.Runtime.PYTHON_3_9,
|
|
85
|
-
handler='index.handler'
|
|
86
|
-
))
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Java
|
|
90
|
-
|
|
91
|
-
```java
|
|
92
|
-
import software.constructs.Construct;
|
|
93
|
-
|
|
94
|
-
import software.amazon.awscdk.Stack;
|
|
95
|
-
import software.amazon.awscdk.StackProps;
|
|
96
|
-
import software.amazon.awscdk.services.lambda.*;
|
|
97
|
-
import software.amazon.awscdk.services.lambda.Runtime;
|
|
98
|
-
import software.amazon.awsconstructs.services.lambdadynamodb.*;
|
|
99
|
-
|
|
100
|
-
new LambdaToDynamoDB(this, "test_lambda_dynamodb_stack", new LambdaToDynamoDBProps.Builder()
|
|
101
|
-
.lambdaFunctionProps(new FunctionProps.Builder()
|
|
102
|
-
.runtime(Runtime.NODEJS_14_X)
|
|
103
|
-
.code(Code.fromAsset("lambda"))
|
|
104
|
-
.handler("index.handler")
|
|
105
|
-
.build())
|
|
106
|
-
.build());
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Pattern Construct Props
|
|
110
|
-
|
|
111
|
-
| **Name** | **Type** | **Description** |
|
|
112
|
-
|:-------------|:----------------|-----------------|
|
|
113
|
-
|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.|
|
|
114
|
-
|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.|
|
|
115
|
-
|dynamoTableProps?|[`dynamodb.TableProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.TableProps.html)|Optional user provided props to override the default props for DynamoDB Table|
|
|
116
|
-
|existingTableObj?|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Existing instance of DynamoDB table object, providing both this and `dynamoTableProps` will cause an error.|
|
|
117
|
-
|tablePermissions?|`string`|Optional table permissions to grant to the Lambda function. One of the following may be specified: `All`, `Read`, `ReadWrite`, `Write`.|
|
|
118
|
-
|tableEnvironmentVariableName?|`string`|Optional Name for the Lambda function environment variable set to the name of the DynamoDB table. Default: DDB_TABLE_NAME |
|
|
119
|
-
|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 and a Gateway Endpoint will be created in the VPC for Amazon DynamoDB. 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.|
|
|
120
|
-
|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 overrriden. If `deployVpc` is not `true` then this property will be ignored.|
|
|
121
|
-
|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`.|
|
|
122
|
-
|
|
123
|
-
## Pattern Properties
|
|
124
|
-
|
|
125
|
-
| **Name** | **Type** | **Description** |
|
|
126
|
-
|:-------------|:----------------|-----------------|
|
|
127
|
-
|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 created by the construct|
|
|
128
|
-
|dynamoTable|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Returns an instance of dynamodb.Table created by the construct|
|
|
129
|
-
|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.|
|
|
130
|
-
|
|
131
|
-
## Default settings
|
|
132
|
-
|
|
133
|
-
Out of the box implementation of the Construct without any override will set the following defaults:
|
|
134
|
-
|
|
135
|
-
### AWS Lambda Function
|
|
136
|
-
|
|
137
|
-
* Configure limited privilege access IAM role for Lambda function
|
|
138
|
-
* Enable reusing connections with Keep-Alive for NodeJs Lambda function
|
|
139
|
-
* Enable X-Ray Tracing
|
|
140
|
-
* Set Environment Variables
|
|
141
|
-
|
|
142
|
-
* (default) DDB_TABLE_NAME
|
|
143
|
-
* AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
|
|
144
|
-
|
|
145
|
-
### Amazon DynamoDB Table
|
|
146
|
-
|
|
147
|
-
* Set the billing mode for DynamoDB Table to On-Demand (Pay per request)
|
|
148
|
-
* Enable server-side encryption for DynamoDB Table using AWS managed KMS Key
|
|
149
|
-
* Creates a partition key called 'id' for DynamoDB Table
|
|
150
|
-
* Retain the Table when deleting the CloudFormation stack
|
|
151
|
-
* Enable continuous backups and point-in-time recovery
|
|
152
|
-
|
|
153
|
-
## Architecture
|
|
154
|
-
|
|
155
|
-

|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|