cloudsnorkel.cdk-turbo-layers 0.1.0__tar.gz → 0.3.1__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.
- {cloudsnorkel.cdk-turbo-layers-0.1.0/src/cloudsnorkel.cdk_turbo_layers.egg-info → cloudsnorkel_cdk_turbo_layers-0.3.1}/PKG-INFO +73 -6
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/README.md +66 -2
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/pyproject.toml +2 -2
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/setup.py +6 -8
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/src/cloudsnorkel/cdk_turbo_layers/__init__.py +182 -100
- cloudsnorkel_cdk_turbo_layers-0.3.1/src/cloudsnorkel/cdk_turbo_layers/_jsii/__init__.py +45 -0
- cloudsnorkel_cdk_turbo_layers-0.3.1/src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.3.1.jsii.tgz +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1/src/cloudsnorkel.cdk_turbo_layers.egg-info}/PKG-INFO +73 -6
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/src/cloudsnorkel.cdk_turbo_layers.egg-info/SOURCES.txt +1 -1
- cloudsnorkel_cdk_turbo_layers-0.3.1/src/cloudsnorkel.cdk_turbo_layers.egg-info/requires.txt +5 -0
- cloudsnorkel.cdk-turbo-layers-0.1.0/src/cloudsnorkel/cdk_turbo_layers/_jsii/__init__.py +0 -27
- cloudsnorkel.cdk-turbo-layers-0.1.0/src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.1.0.jsii.tgz +0 -0
- cloudsnorkel.cdk-turbo-layers-0.1.0/src/cloudsnorkel.cdk_turbo_layers.egg-info/requires.txt +0 -5
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/LICENSE +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/MANIFEST.in +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/setup.cfg +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/src/cloudsnorkel/cdk_turbo_layers/py.typed +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/src/cloudsnorkel.cdk_turbo_layers.egg-info/dependency_links.txt +0 -0
- {cloudsnorkel.cdk-turbo-layers-0.1.0 → cloudsnorkel_cdk_turbo_layers-0.3.1}/src/cloudsnorkel.cdk_turbo_layers.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloudsnorkel.cdk-turbo-layers
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Speed-up Lambda function deployment with dependency layers built in AWS
|
|
5
5
|
Home-page: https://github.com/CloudSnorkel/cdk-turbo-layers.git
|
|
6
6
|
Author: Amir Szekely<amir@cloudsnorkel.com>
|
|
@@ -10,17 +10,20 @@ Classifier: Intended Audience :: Developers
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: JavaScript
|
|
12
12
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
16
|
Classifier: Typing :: Typed
|
|
19
17
|
Classifier: Development Status :: 4 - Beta
|
|
20
18
|
Classifier: License :: OSI Approved
|
|
21
|
-
Requires-Python: ~=3.
|
|
19
|
+
Requires-Python: ~=3.9
|
|
22
20
|
Description-Content-Type: text/markdown
|
|
23
21
|
License-File: LICENSE
|
|
22
|
+
Requires-Dist: aws-cdk-lib<3.0.0,>=2.146.0
|
|
23
|
+
Requires-Dist: constructs<11.0.0,>=10.0.5
|
|
24
|
+
Requires-Dist: jsii<2.0.0,>=1.126.0
|
|
25
|
+
Requires-Dist: publication>=0.0.3
|
|
26
|
+
Requires-Dist: typeguard==2.13.3
|
|
24
27
|
|
|
25
28
|
# Turbo Layers for CDK
|
|
26
29
|
|
|
@@ -107,7 +110,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
107
110
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
108
111
|
```
|
|
109
112
|
|
|
110
|
-
##
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
111
116
|
|
|
112
117
|
```python
|
|
113
118
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -121,15 +126,77 @@ new Function(this, 'Function with inline requirements', {
|
|
|
121
126
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
122
127
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
123
128
|
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
135
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
136
|
+
type: DependencyPackagerType.LAMBDA,
|
|
137
|
+
});
|
|
124
138
|
new Function(this, 'Function with external source and requirements', {
|
|
125
139
|
handler: 'index.handler',
|
|
126
140
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
127
141
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
142
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
143
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
151
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
152
|
+
type: DependencyPackagerType.LAMBDA,
|
|
153
|
+
});
|
|
154
|
+
new Function(this, 'Function with external source and requirements', {
|
|
155
|
+
handler: 'index.handler',
|
|
156
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
157
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
128
158
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
129
|
-
layers: [packager.layerFromPoetry('poetry
|
|
159
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
130
160
|
});
|
|
131
161
|
```
|
|
132
162
|
|
|
163
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
167
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
168
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
169
|
+
preinstallCommands: [
|
|
170
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
new Function(this, 'Function with external source and requirements', {
|
|
174
|
+
handler: 'index.handler',
|
|
175
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
176
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
177
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Building layers for ARM64 functions is also supported.
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
185
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
186
|
+
type: DependencyPackagerType.LAMBDA,
|
|
187
|
+
architecture: Architecture.ARM_64,
|
|
188
|
+
});
|
|
189
|
+
new Function(this, 'Function with external source and requirements', {
|
|
190
|
+
handler: 'index.handler',
|
|
191
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
192
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
193
|
+
architecture: Architecture.ARM_64,
|
|
194
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
199
|
+
|
|
133
200
|
## Older Implementations
|
|
134
201
|
|
|
135
202
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
@@ -83,7 +83,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
83
83
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
##
|
|
86
|
+
## Examples
|
|
87
|
+
|
|
88
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
87
89
|
|
|
88
90
|
```python
|
|
89
91
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -97,15 +99,77 @@ new Function(this, 'Function with inline requirements', {
|
|
|
97
99
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
98
100
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
99
101
|
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
108
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
109
|
+
type: DependencyPackagerType.LAMBDA,
|
|
110
|
+
});
|
|
100
111
|
new Function(this, 'Function with external source and requirements', {
|
|
101
112
|
handler: 'index.handler',
|
|
102
113
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
103
114
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
115
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
116
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
124
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
125
|
+
type: DependencyPackagerType.LAMBDA,
|
|
126
|
+
});
|
|
127
|
+
new Function(this, 'Function with external source and requirements', {
|
|
128
|
+
handler: 'index.handler',
|
|
129
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
130
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
104
131
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
105
|
-
layers: [packager.layerFromPoetry('poetry
|
|
132
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
106
133
|
});
|
|
107
134
|
```
|
|
108
135
|
|
|
136
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
140
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
141
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
142
|
+
preinstallCommands: [
|
|
143
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
144
|
+
],
|
|
145
|
+
});
|
|
146
|
+
new Function(this, 'Function with external source and requirements', {
|
|
147
|
+
handler: 'index.handler',
|
|
148
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
149
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
150
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Building layers for ARM64 functions is also supported.
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
158
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
159
|
+
type: DependencyPackagerType.LAMBDA,
|
|
160
|
+
architecture: Architecture.ARM_64,
|
|
161
|
+
});
|
|
162
|
+
new Function(this, 'Function with external source and requirements', {
|
|
163
|
+
handler: 'index.handler',
|
|
164
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
165
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
166
|
+
architecture: Architecture.ARM_64,
|
|
167
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
172
|
+
|
|
109
173
|
## Older Implementations
|
|
110
174
|
|
|
111
175
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
@@ -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": "cloudsnorkel.cdk-turbo-layers",
|
|
8
|
-
"version": "0.1
|
|
8
|
+
"version": "0.3.1",
|
|
9
9
|
"description": "Speed-up Lambda function deployment with dependency layers built in AWS",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"url": "https://github.com/CloudSnorkel/cdk-turbo-layers.git",
|
|
@@ -26,27 +26,25 @@ kwargs = json.loads(
|
|
|
26
26
|
],
|
|
27
27
|
"package_data": {
|
|
28
28
|
"cloudsnorkel.cdk_turbo_layers._jsii": [
|
|
29
|
-
"cdk-turbo-layers@0.1.
|
|
29
|
+
"cdk-turbo-layers@0.3.1.jsii.tgz"
|
|
30
30
|
],
|
|
31
31
|
"cloudsnorkel.cdk_turbo_layers": [
|
|
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.
|
|
37
|
+
"aws-cdk-lib>=2.146.0, <3.0.0",
|
|
38
38
|
"constructs>=10.0.5, <11.0.0",
|
|
39
|
-
"jsii>=1.
|
|
39
|
+
"jsii>=1.126.0, <2.0.0",
|
|
40
40
|
"publication>=0.0.3",
|
|
41
|
-
"typeguard
|
|
41
|
+
"typeguard==2.13.3"
|
|
42
42
|
],
|
|
43
43
|
"classifiers": [
|
|
44
44
|
"Intended Audience :: Developers",
|
|
45
45
|
"Operating System :: OS Independent",
|
|
46
46
|
"Programming Language :: JavaScript",
|
|
47
47
|
"Programming Language :: Python :: 3 :: Only",
|
|
48
|
-
"Programming Language :: Python :: 3.7",
|
|
49
|
-
"Programming Language :: Python :: 3.8",
|
|
50
48
|
"Programming Language :: Python :: 3.9",
|
|
51
49
|
"Programming Language :: Python :: 3.10",
|
|
52
50
|
"Programming Language :: Python :: 3.11",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'''
|
|
1
|
+
r'''
|
|
2
2
|
# Turbo Layers for CDK
|
|
3
3
|
|
|
4
4
|
[](https://www.npmjs.com/package/@cloudsnorkel/cdk-turbo-layers)
|
|
@@ -84,7 +84,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
84
84
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
##
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
88
90
|
|
|
89
91
|
```python
|
|
90
92
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -98,20 +100,85 @@ new Function(this, 'Function with inline requirements', {
|
|
|
98
100
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
99
101
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
100
102
|
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
109
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
110
|
+
type: DependencyPackagerType.LAMBDA,
|
|
111
|
+
});
|
|
101
112
|
new Function(this, 'Function with external source and requirements', {
|
|
102
113
|
handler: 'index.handler',
|
|
103
114
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
104
115
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
116
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
117
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
125
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
126
|
+
type: DependencyPackagerType.LAMBDA,
|
|
127
|
+
});
|
|
128
|
+
new Function(this, 'Function with external source and requirements', {
|
|
129
|
+
handler: 'index.handler',
|
|
130
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
131
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
105
132
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
106
|
-
layers: [packager.layerFromPoetry('poetry
|
|
133
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
107
134
|
});
|
|
108
135
|
```
|
|
109
136
|
|
|
137
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
141
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
142
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
143
|
+
preinstallCommands: [
|
|
144
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
145
|
+
],
|
|
146
|
+
});
|
|
147
|
+
new Function(this, 'Function with external source and requirements', {
|
|
148
|
+
handler: 'index.handler',
|
|
149
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
150
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
151
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Building layers for ARM64 functions is also supported.
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
159
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
160
|
+
type: DependencyPackagerType.LAMBDA,
|
|
161
|
+
architecture: Architecture.ARM_64,
|
|
162
|
+
});
|
|
163
|
+
new Function(this, 'Function with external source and requirements', {
|
|
164
|
+
handler: 'index.handler',
|
|
165
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
166
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
167
|
+
architecture: Architecture.ARM_64,
|
|
168
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
173
|
+
|
|
110
174
|
## Older Implementations
|
|
111
175
|
|
|
112
176
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
113
177
|
* [serverless-pydeps](https://github.com/CloudSnorkel/serverless-pydeps): plugin for [Serverless Framework](https://www.serverless.com/) that speeds up deployment
|
|
114
178
|
'''
|
|
179
|
+
from pkgutil import extend_path
|
|
180
|
+
__path__ = extend_path(__path__, __name__)
|
|
181
|
+
|
|
115
182
|
import abc
|
|
116
183
|
import builtins
|
|
117
184
|
import datetime
|
|
@@ -122,7 +189,22 @@ import jsii
|
|
|
122
189
|
import publication
|
|
123
190
|
import typing_extensions
|
|
124
191
|
|
|
125
|
-
|
|
192
|
+
import typeguard
|
|
193
|
+
from importlib.metadata import version as _metadata_package_version
|
|
194
|
+
TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
|
|
195
|
+
|
|
196
|
+
def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
|
|
197
|
+
if TYPEGUARD_MAJOR_VERSION <= 2:
|
|
198
|
+
return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
|
|
199
|
+
else:
|
|
200
|
+
if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
|
|
201
|
+
pass
|
|
202
|
+
else:
|
|
203
|
+
if TYPEGUARD_MAJOR_VERSION == 3:
|
|
204
|
+
typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
|
|
205
|
+
typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
|
|
206
|
+
else:
|
|
207
|
+
typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
|
|
126
208
|
|
|
127
209
|
from ._jsii import *
|
|
128
210
|
|
|
@@ -152,23 +234,23 @@ class DependencyPackagerProps:
|
|
|
152
234
|
def __init__(
|
|
153
235
|
self,
|
|
154
236
|
*,
|
|
155
|
-
architecture: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Architecture] = None,
|
|
156
|
-
log_removal_policy: typing.Optional[_aws_cdk_ceddda9d.RemovalPolicy] = None,
|
|
157
|
-
log_retention: typing.Optional[_aws_cdk_aws_logs_ceddda9d.RetentionDays] = None,
|
|
237
|
+
architecture: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Architecture"] = None,
|
|
238
|
+
log_removal_policy: typing.Optional["_aws_cdk_ceddda9d.RemovalPolicy"] = None,
|
|
239
|
+
log_retention: typing.Optional["_aws_cdk_aws_logs_ceddda9d.RetentionDays"] = None,
|
|
158
240
|
preinstall_commands: typing.Optional[typing.Sequence[builtins.str]] = None,
|
|
159
|
-
runtime: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Runtime] = None,
|
|
160
|
-
subnet_selection: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.SubnetSelection, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
241
|
+
runtime: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Runtime"] = None,
|
|
242
|
+
subnet_selection: typing.Optional[typing.Union["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
161
243
|
type: typing.Optional["DependencyPackagerType"] = None,
|
|
162
|
-
vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
|
|
244
|
+
vpc: typing.Optional["_aws_cdk_aws_ec2_ceddda9d.IVpc"] = None,
|
|
163
245
|
) -> None:
|
|
164
246
|
'''
|
|
165
247
|
:param architecture: (experimental) Target Lambda architecture. Packages will be installed for this architecture so make sure it fits your Lambda functions.
|
|
166
|
-
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way
|
|
248
|
+
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way logs can still be viewed, and you can see why the build failed. We try to not leave anything behind when removed. But sometimes a log staying behind is useful. Default: RemovalPolicy.DESTROY
|
|
167
249
|
:param log_retention: (experimental) The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to ``INFINITE``. Default: logs.RetentionDays.ONE_MONTH
|
|
168
250
|
:param preinstall_commands: (experimental) Additional commands to run before installing packages. Use this to authenticate your package repositories like CodeArtifact. Default: []
|
|
169
251
|
:param runtime: (experimental) Target Lambda runtime. Packages will be installed for this runtime so make sure it fits your Lambda functions.
|
|
170
252
|
:param subnet_selection: (experimental) VPC subnets used for packager. Default: default subnets, if VPC is used
|
|
171
|
-
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA}
|
|
253
|
+
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA }
|
|
172
254
|
:param vpc: (experimental) VPC used for packager. Use this if your package repositories are only available from within a VPC. Default: no VPC
|
|
173
255
|
|
|
174
256
|
:stability: experimental
|
|
@@ -206,7 +288,7 @@ class DependencyPackagerProps:
|
|
|
206
288
|
@builtins.property
|
|
207
289
|
def architecture(
|
|
208
290
|
self,
|
|
209
|
-
) -> typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Architecture]:
|
|
291
|
+
) -> typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Architecture"]:
|
|
210
292
|
'''(experimental) Target Lambda architecture.
|
|
211
293
|
|
|
212
294
|
Packages will be installed for this architecture so make sure it fits your Lambda functions.
|
|
@@ -214,13 +296,13 @@ class DependencyPackagerProps:
|
|
|
214
296
|
:stability: experimental
|
|
215
297
|
'''
|
|
216
298
|
result = self._values.get("architecture")
|
|
217
|
-
return typing.cast(typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Architecture], result)
|
|
299
|
+
return typing.cast(typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Architecture"], result)
|
|
218
300
|
|
|
219
301
|
@builtins.property
|
|
220
|
-
def log_removal_policy(self) -> typing.Optional[_aws_cdk_ceddda9d.RemovalPolicy]:
|
|
302
|
+
def log_removal_policy(self) -> typing.Optional["_aws_cdk_ceddda9d.RemovalPolicy"]:
|
|
221
303
|
'''(experimental) Removal policy for logs of image builds.
|
|
222
304
|
|
|
223
|
-
If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way
|
|
305
|
+
If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way logs can still be viewed, and you can see why the build failed.
|
|
224
306
|
|
|
225
307
|
We try to not leave anything behind when removed. But sometimes a log staying behind is useful.
|
|
226
308
|
|
|
@@ -229,12 +311,12 @@ class DependencyPackagerProps:
|
|
|
229
311
|
:stability: experimental
|
|
230
312
|
'''
|
|
231
313
|
result = self._values.get("log_removal_policy")
|
|
232
|
-
return typing.cast(typing.Optional[_aws_cdk_ceddda9d.RemovalPolicy], result)
|
|
314
|
+
return typing.cast(typing.Optional["_aws_cdk_ceddda9d.RemovalPolicy"], result)
|
|
233
315
|
|
|
234
316
|
@builtins.property
|
|
235
317
|
def log_retention(
|
|
236
318
|
self,
|
|
237
|
-
) -> typing.Optional[_aws_cdk_aws_logs_ceddda9d.RetentionDays]:
|
|
319
|
+
) -> typing.Optional["_aws_cdk_aws_logs_ceddda9d.RetentionDays"]:
|
|
238
320
|
'''(experimental) The number of days log events are kept in CloudWatch Logs.
|
|
239
321
|
|
|
240
322
|
When updating
|
|
@@ -246,7 +328,7 @@ class DependencyPackagerProps:
|
|
|
246
328
|
:stability: experimental
|
|
247
329
|
'''
|
|
248
330
|
result = self._values.get("log_retention")
|
|
249
|
-
return typing.cast(typing.Optional[_aws_cdk_aws_logs_ceddda9d.RetentionDays], result)
|
|
331
|
+
return typing.cast(typing.Optional["_aws_cdk_aws_logs_ceddda9d.RetentionDays"], result)
|
|
250
332
|
|
|
251
333
|
@builtins.property
|
|
252
334
|
def preinstall_commands(self) -> typing.Optional[typing.List[builtins.str]]:
|
|
@@ -262,7 +344,7 @@ class DependencyPackagerProps:
|
|
|
262
344
|
return typing.cast(typing.Optional[typing.List[builtins.str]], result)
|
|
263
345
|
|
|
264
346
|
@builtins.property
|
|
265
|
-
def runtime(self) -> typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Runtime]:
|
|
347
|
+
def runtime(self) -> typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Runtime"]:
|
|
266
348
|
'''(experimental) Target Lambda runtime.
|
|
267
349
|
|
|
268
350
|
Packages will be installed for this runtime so make sure it fits your Lambda functions.
|
|
@@ -270,12 +352,12 @@ class DependencyPackagerProps:
|
|
|
270
352
|
:stability: experimental
|
|
271
353
|
'''
|
|
272
354
|
result = self._values.get("runtime")
|
|
273
|
-
return typing.cast(typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Runtime], result)
|
|
355
|
+
return typing.cast(typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Runtime"], result)
|
|
274
356
|
|
|
275
357
|
@builtins.property
|
|
276
358
|
def subnet_selection(
|
|
277
359
|
self,
|
|
278
|
-
) -> typing.Optional[_aws_cdk_aws_ec2_ceddda9d.SubnetSelection]:
|
|
360
|
+
) -> typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"]:
|
|
279
361
|
'''(experimental) VPC subnets used for packager.
|
|
280
362
|
|
|
281
363
|
:default: default subnets, if VPC is used
|
|
@@ -283,7 +365,7 @@ class DependencyPackagerProps:
|
|
|
283
365
|
:stability: experimental
|
|
284
366
|
'''
|
|
285
367
|
result = self._values.get("subnet_selection")
|
|
286
|
-
return typing.cast(typing.Optional[_aws_cdk_aws_ec2_ceddda9d.SubnetSelection], result)
|
|
368
|
+
return typing.cast(typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"], result)
|
|
287
369
|
|
|
288
370
|
@builtins.property
|
|
289
371
|
def type(self) -> typing.Optional["DependencyPackagerType"]:
|
|
@@ -291,7 +373,7 @@ class DependencyPackagerProps:
|
|
|
291
373
|
|
|
292
374
|
Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions.
|
|
293
375
|
|
|
294
|
-
:default: {@link DependencyPackagerType.LAMBDA}
|
|
376
|
+
:default: {@link DependencyPackagerType.LAMBDA }
|
|
295
377
|
|
|
296
378
|
:stability: experimental
|
|
297
379
|
'''
|
|
@@ -299,7 +381,7 @@ class DependencyPackagerProps:
|
|
|
299
381
|
return typing.cast(typing.Optional["DependencyPackagerType"], result)
|
|
300
382
|
|
|
301
383
|
@builtins.property
|
|
302
|
-
def vpc(self) -> typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc]:
|
|
384
|
+
def vpc(self) -> typing.Optional["_aws_cdk_aws_ec2_ceddda9d.IVpc"]:
|
|
303
385
|
'''(experimental) VPC used for packager.
|
|
304
386
|
|
|
305
387
|
Use this if your package repositories are only available from within a VPC.
|
|
@@ -309,7 +391,7 @@ class DependencyPackagerProps:
|
|
|
309
391
|
:stability: experimental
|
|
310
392
|
'''
|
|
311
393
|
result = self._values.get("vpc")
|
|
312
|
-
return typing.cast(typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc], result)
|
|
394
|
+
return typing.cast(typing.Optional["_aws_cdk_aws_ec2_ceddda9d.IVpc"], result)
|
|
313
395
|
|
|
314
396
|
def __eq__(self, rhs: typing.Any) -> builtins.bool:
|
|
315
397
|
return isinstance(rhs, self.__class__) and rhs._values == self._values
|
|
@@ -363,28 +445,28 @@ class JavaDependencyPackager(
|
|
|
363
445
|
|
|
364
446
|
def __init__(
|
|
365
447
|
self,
|
|
366
|
-
scope: _constructs_77d1e7e8.Construct,
|
|
448
|
+
scope: "_constructs_77d1e7e8.Construct",
|
|
367
449
|
id: builtins.str,
|
|
368
450
|
*,
|
|
369
|
-
architecture: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Architecture] = None,
|
|
370
|
-
log_removal_policy: typing.Optional[_aws_cdk_ceddda9d.RemovalPolicy] = None,
|
|
371
|
-
log_retention: typing.Optional[_aws_cdk_aws_logs_ceddda9d.RetentionDays] = None,
|
|
451
|
+
architecture: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Architecture"] = None,
|
|
452
|
+
log_removal_policy: typing.Optional["_aws_cdk_ceddda9d.RemovalPolicy"] = None,
|
|
453
|
+
log_retention: typing.Optional["_aws_cdk_aws_logs_ceddda9d.RetentionDays"] = None,
|
|
372
454
|
preinstall_commands: typing.Optional[typing.Sequence[builtins.str]] = None,
|
|
373
|
-
runtime: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Runtime] = None,
|
|
374
|
-
subnet_selection: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.SubnetSelection, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
375
|
-
type: typing.Optional[DependencyPackagerType] = None,
|
|
376
|
-
vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
|
|
455
|
+
runtime: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Runtime"] = None,
|
|
456
|
+
subnet_selection: typing.Optional[typing.Union["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
457
|
+
type: typing.Optional["DependencyPackagerType"] = None,
|
|
458
|
+
vpc: typing.Optional["_aws_cdk_aws_ec2_ceddda9d.IVpc"] = None,
|
|
377
459
|
) -> None:
|
|
378
460
|
'''
|
|
379
461
|
:param scope: -
|
|
380
462
|
:param id: -
|
|
381
463
|
:param architecture: (experimental) Target Lambda architecture. Packages will be installed for this architecture so make sure it fits your Lambda functions.
|
|
382
|
-
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way
|
|
464
|
+
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way logs can still be viewed, and you can see why the build failed. We try to not leave anything behind when removed. But sometimes a log staying behind is useful. Default: RemovalPolicy.DESTROY
|
|
383
465
|
:param log_retention: (experimental) The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to ``INFINITE``. Default: logs.RetentionDays.ONE_MONTH
|
|
384
466
|
:param preinstall_commands: (experimental) Additional commands to run before installing packages. Use this to authenticate your package repositories like CodeArtifact. Default: []
|
|
385
467
|
:param runtime: (experimental) Target Lambda runtime. Packages will be installed for this runtime so make sure it fits your Lambda functions.
|
|
386
468
|
:param subnet_selection: (experimental) VPC subnets used for packager. Default: default subnets, if VPC is used
|
|
387
|
-
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA}
|
|
469
|
+
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA }
|
|
388
470
|
:param vpc: (experimental) VPC used for packager. Use this if your package repositories are only available from within a VPC. Default: no VPC
|
|
389
471
|
|
|
390
472
|
:stability: experimental
|
|
@@ -413,7 +495,7 @@ class JavaDependencyPackager(
|
|
|
413
495
|
path: builtins.str,
|
|
414
496
|
*,
|
|
415
497
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
416
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
498
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
417
499
|
'''(experimental) Create a layer for dependencies defined in pom.xml installed with Maven.
|
|
418
500
|
|
|
419
501
|
:param id: -
|
|
@@ -428,25 +510,25 @@ class JavaDependencyPackager(
|
|
|
428
510
|
check_type(argname="argument path", value=path, expected_type=type_hints["path"])
|
|
429
511
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
430
512
|
|
|
431
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromMaven", [id, path, props]))
|
|
513
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromMaven", [id, path, props]))
|
|
432
514
|
|
|
433
515
|
@builtins.property
|
|
434
516
|
@jsii.member(jsii_name="connections")
|
|
435
|
-
def connections(self) -> _aws_cdk_aws_ec2_ceddda9d.Connections:
|
|
517
|
+
def connections(self) -> "_aws_cdk_aws_ec2_ceddda9d.Connections":
|
|
436
518
|
'''(experimental) The network connections associated with this resource.
|
|
437
519
|
|
|
438
520
|
:stability: experimental
|
|
439
521
|
'''
|
|
440
|
-
return typing.cast(_aws_cdk_aws_ec2_ceddda9d.Connections, jsii.get(self, "connections"))
|
|
522
|
+
return typing.cast("_aws_cdk_aws_ec2_ceddda9d.Connections", jsii.get(self, "connections"))
|
|
441
523
|
|
|
442
524
|
@builtins.property
|
|
443
525
|
@jsii.member(jsii_name="grantPrincipal")
|
|
444
|
-
def grant_principal(self) -> _aws_cdk_aws_iam_ceddda9d.IPrincipal:
|
|
526
|
+
def grant_principal(self) -> "_aws_cdk_aws_iam_ceddda9d.IPrincipal":
|
|
445
527
|
'''(experimental) The principal to grant permissions to.
|
|
446
528
|
|
|
447
529
|
:stability: experimental
|
|
448
530
|
'''
|
|
449
|
-
return typing.cast(_aws_cdk_aws_iam_ceddda9d.IPrincipal, jsii.get(self, "grantPrincipal"))
|
|
531
|
+
return typing.cast("_aws_cdk_aws_iam_ceddda9d.IPrincipal", jsii.get(self, "grantPrincipal"))
|
|
450
532
|
|
|
451
533
|
|
|
452
534
|
@jsii.data_type(
|
|
@@ -508,28 +590,28 @@ class NodejsDependencyPackager(
|
|
|
508
590
|
|
|
509
591
|
def __init__(
|
|
510
592
|
self,
|
|
511
|
-
scope: _constructs_77d1e7e8.Construct,
|
|
593
|
+
scope: "_constructs_77d1e7e8.Construct",
|
|
512
594
|
id: builtins.str,
|
|
513
595
|
*,
|
|
514
|
-
architecture: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Architecture] = None,
|
|
515
|
-
log_removal_policy: typing.Optional[_aws_cdk_ceddda9d.RemovalPolicy] = None,
|
|
516
|
-
log_retention: typing.Optional[_aws_cdk_aws_logs_ceddda9d.RetentionDays] = None,
|
|
596
|
+
architecture: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Architecture"] = None,
|
|
597
|
+
log_removal_policy: typing.Optional["_aws_cdk_ceddda9d.RemovalPolicy"] = None,
|
|
598
|
+
log_retention: typing.Optional["_aws_cdk_aws_logs_ceddda9d.RetentionDays"] = None,
|
|
517
599
|
preinstall_commands: typing.Optional[typing.Sequence[builtins.str]] = None,
|
|
518
|
-
runtime: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Runtime] = None,
|
|
519
|
-
subnet_selection: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.SubnetSelection, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
520
|
-
type: typing.Optional[DependencyPackagerType] = None,
|
|
521
|
-
vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
|
|
600
|
+
runtime: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Runtime"] = None,
|
|
601
|
+
subnet_selection: typing.Optional[typing.Union["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
602
|
+
type: typing.Optional["DependencyPackagerType"] = None,
|
|
603
|
+
vpc: typing.Optional["_aws_cdk_aws_ec2_ceddda9d.IVpc"] = None,
|
|
522
604
|
) -> None:
|
|
523
605
|
'''
|
|
524
606
|
:param scope: -
|
|
525
607
|
:param id: -
|
|
526
608
|
:param architecture: (experimental) Target Lambda architecture. Packages will be installed for this architecture so make sure it fits your Lambda functions.
|
|
527
|
-
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way
|
|
609
|
+
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way logs can still be viewed, and you can see why the build failed. We try to not leave anything behind when removed. But sometimes a log staying behind is useful. Default: RemovalPolicy.DESTROY
|
|
528
610
|
:param log_retention: (experimental) The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to ``INFINITE``. Default: logs.RetentionDays.ONE_MONTH
|
|
529
611
|
:param preinstall_commands: (experimental) Additional commands to run before installing packages. Use this to authenticate your package repositories like CodeArtifact. Default: []
|
|
530
612
|
:param runtime: (experimental) Target Lambda runtime. Packages will be installed for this runtime so make sure it fits your Lambda functions.
|
|
531
613
|
:param subnet_selection: (experimental) VPC subnets used for packager. Default: default subnets, if VPC is used
|
|
532
|
-
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA}
|
|
614
|
+
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA }
|
|
533
615
|
:param vpc: (experimental) VPC used for packager. Use this if your package repositories are only available from within a VPC. Default: no VPC
|
|
534
616
|
|
|
535
617
|
:stability: experimental
|
|
@@ -558,7 +640,7 @@ class NodejsDependencyPackager(
|
|
|
558
640
|
libraries: typing.Sequence[builtins.str],
|
|
559
641
|
*,
|
|
560
642
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
561
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
643
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
562
644
|
'''(experimental) Create a layer for dependencies passed as an argument and installed with npm.
|
|
563
645
|
|
|
564
646
|
:param id: -
|
|
@@ -573,7 +655,7 @@ class NodejsDependencyPackager(
|
|
|
573
655
|
check_type(argname="argument libraries", value=libraries, expected_type=type_hints["libraries"])
|
|
574
656
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
575
657
|
|
|
576
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromInline", [id, libraries, props]))
|
|
658
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromInline", [id, libraries, props]))
|
|
577
659
|
|
|
578
660
|
@jsii.member(jsii_name="layerFromPackageJson")
|
|
579
661
|
def layer_from_package_json(
|
|
@@ -582,7 +664,7 @@ class NodejsDependencyPackager(
|
|
|
582
664
|
path: builtins.str,
|
|
583
665
|
*,
|
|
584
666
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
585
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
667
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
586
668
|
'''(experimental) Create a layer for dependencies defined in package.json and (optionally) package-lock.json and installed with npm.
|
|
587
669
|
|
|
588
670
|
:param id: -
|
|
@@ -597,7 +679,7 @@ class NodejsDependencyPackager(
|
|
|
597
679
|
check_type(argname="argument path", value=path, expected_type=type_hints["path"])
|
|
598
680
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
599
681
|
|
|
600
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromPackageJson", [id, path, props]))
|
|
682
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromPackageJson", [id, path, props]))
|
|
601
683
|
|
|
602
684
|
@jsii.member(jsii_name="layerFromYarn")
|
|
603
685
|
def layer_from_yarn(
|
|
@@ -606,7 +688,7 @@ class NodejsDependencyPackager(
|
|
|
606
688
|
path: builtins.str,
|
|
607
689
|
*,
|
|
608
690
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
609
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
691
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
610
692
|
'''(experimental) Create a layer for dependencies defined in package.json and yarn.lock and installed with yarn.
|
|
611
693
|
|
|
612
694
|
:param id: -
|
|
@@ -621,25 +703,25 @@ class NodejsDependencyPackager(
|
|
|
621
703
|
check_type(argname="argument path", value=path, expected_type=type_hints["path"])
|
|
622
704
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
623
705
|
|
|
624
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromYarn", [id, path, props]))
|
|
706
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromYarn", [id, path, props]))
|
|
625
707
|
|
|
626
708
|
@builtins.property
|
|
627
709
|
@jsii.member(jsii_name="connections")
|
|
628
|
-
def connections(self) -> _aws_cdk_aws_ec2_ceddda9d.Connections:
|
|
710
|
+
def connections(self) -> "_aws_cdk_aws_ec2_ceddda9d.Connections":
|
|
629
711
|
'''(experimental) The network connections associated with this resource.
|
|
630
712
|
|
|
631
713
|
:stability: experimental
|
|
632
714
|
'''
|
|
633
|
-
return typing.cast(_aws_cdk_aws_ec2_ceddda9d.Connections, jsii.get(self, "connections"))
|
|
715
|
+
return typing.cast("_aws_cdk_aws_ec2_ceddda9d.Connections", jsii.get(self, "connections"))
|
|
634
716
|
|
|
635
717
|
@builtins.property
|
|
636
718
|
@jsii.member(jsii_name="grantPrincipal")
|
|
637
|
-
def grant_principal(self) -> _aws_cdk_aws_iam_ceddda9d.IPrincipal:
|
|
719
|
+
def grant_principal(self) -> "_aws_cdk_aws_iam_ceddda9d.IPrincipal":
|
|
638
720
|
'''(experimental) The principal to grant permissions to.
|
|
639
721
|
|
|
640
722
|
:stability: experimental
|
|
641
723
|
'''
|
|
642
|
-
return typing.cast(_aws_cdk_aws_iam_ceddda9d.IPrincipal, jsii.get(self, "grantPrincipal"))
|
|
724
|
+
return typing.cast("_aws_cdk_aws_iam_ceddda9d.IPrincipal", jsii.get(self, "grantPrincipal"))
|
|
643
725
|
|
|
644
726
|
|
|
645
727
|
@jsii.implements(_aws_cdk_aws_iam_ceddda9d.IGrantable, _aws_cdk_aws_ec2_ceddda9d.IConnectable)
|
|
@@ -657,28 +739,28 @@ class PythonDependencyPackager(
|
|
|
657
739
|
|
|
658
740
|
def __init__(
|
|
659
741
|
self,
|
|
660
|
-
scope: _constructs_77d1e7e8.Construct,
|
|
742
|
+
scope: "_constructs_77d1e7e8.Construct",
|
|
661
743
|
id: builtins.str,
|
|
662
744
|
*,
|
|
663
|
-
architecture: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Architecture] = None,
|
|
664
|
-
log_removal_policy: typing.Optional[_aws_cdk_ceddda9d.RemovalPolicy] = None,
|
|
665
|
-
log_retention: typing.Optional[_aws_cdk_aws_logs_ceddda9d.RetentionDays] = None,
|
|
745
|
+
architecture: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Architecture"] = None,
|
|
746
|
+
log_removal_policy: typing.Optional["_aws_cdk_ceddda9d.RemovalPolicy"] = None,
|
|
747
|
+
log_retention: typing.Optional["_aws_cdk_aws_logs_ceddda9d.RetentionDays"] = None,
|
|
666
748
|
preinstall_commands: typing.Optional[typing.Sequence[builtins.str]] = None,
|
|
667
|
-
runtime: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Runtime] = None,
|
|
668
|
-
subnet_selection: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.SubnetSelection, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
669
|
-
type: typing.Optional[DependencyPackagerType] = None,
|
|
670
|
-
vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
|
|
749
|
+
runtime: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Runtime"] = None,
|
|
750
|
+
subnet_selection: typing.Optional[typing.Union["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
751
|
+
type: typing.Optional["DependencyPackagerType"] = None,
|
|
752
|
+
vpc: typing.Optional["_aws_cdk_aws_ec2_ceddda9d.IVpc"] = None,
|
|
671
753
|
) -> None:
|
|
672
754
|
'''
|
|
673
755
|
:param scope: -
|
|
674
756
|
:param id: -
|
|
675
757
|
:param architecture: (experimental) Target Lambda architecture. Packages will be installed for this architecture so make sure it fits your Lambda functions.
|
|
676
|
-
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way
|
|
758
|
+
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way logs can still be viewed, and you can see why the build failed. We try to not leave anything behind when removed. But sometimes a log staying behind is useful. Default: RemovalPolicy.DESTROY
|
|
677
759
|
:param log_retention: (experimental) The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to ``INFINITE``. Default: logs.RetentionDays.ONE_MONTH
|
|
678
760
|
:param preinstall_commands: (experimental) Additional commands to run before installing packages. Use this to authenticate your package repositories like CodeArtifact. Default: []
|
|
679
761
|
:param runtime: (experimental) Target Lambda runtime. Packages will be installed for this runtime so make sure it fits your Lambda functions.
|
|
680
762
|
:param subnet_selection: (experimental) VPC subnets used for packager. Default: default subnets, if VPC is used
|
|
681
|
-
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA}
|
|
763
|
+
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA }
|
|
682
764
|
:param vpc: (experimental) VPC used for packager. Use this if your package repositories are only available from within a VPC. Default: no VPC
|
|
683
765
|
|
|
684
766
|
:stability: experimental
|
|
@@ -707,7 +789,7 @@ class PythonDependencyPackager(
|
|
|
707
789
|
requirements: typing.Sequence[builtins.str],
|
|
708
790
|
*,
|
|
709
791
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
710
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
792
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
711
793
|
'''(experimental) Create a layer for dependencies passed as an argument and installed with pip.
|
|
712
794
|
|
|
713
795
|
:param id: -
|
|
@@ -722,7 +804,7 @@ class PythonDependencyPackager(
|
|
|
722
804
|
check_type(argname="argument requirements", value=requirements, expected_type=type_hints["requirements"])
|
|
723
805
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
724
806
|
|
|
725
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromInline", [id, requirements, props]))
|
|
807
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromInline", [id, requirements, props]))
|
|
726
808
|
|
|
727
809
|
@jsii.member(jsii_name="layerFromPipenv")
|
|
728
810
|
def layer_from_pipenv(
|
|
@@ -731,7 +813,7 @@ class PythonDependencyPackager(
|
|
|
731
813
|
path: builtins.str,
|
|
732
814
|
*,
|
|
733
815
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
734
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
816
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
735
817
|
'''(experimental) Create a layer for dependencies defined in Pipfile and (optionally) Pipfile.lock and installed with pipenv.
|
|
736
818
|
|
|
737
819
|
:param id: -
|
|
@@ -746,7 +828,7 @@ class PythonDependencyPackager(
|
|
|
746
828
|
check_type(argname="argument path", value=path, expected_type=type_hints["path"])
|
|
747
829
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
748
830
|
|
|
749
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromPipenv", [id, path, props]))
|
|
831
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromPipenv", [id, path, props]))
|
|
750
832
|
|
|
751
833
|
@jsii.member(jsii_name="layerFromPoetry")
|
|
752
834
|
def layer_from_poetry(
|
|
@@ -755,7 +837,7 @@ class PythonDependencyPackager(
|
|
|
755
837
|
path: builtins.str,
|
|
756
838
|
*,
|
|
757
839
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
758
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
840
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
759
841
|
'''(experimental) Create a layer for dependencies defined in pyproject.toml and (optionally) poetry.lock and installed with poetry.
|
|
760
842
|
|
|
761
843
|
:param id: -
|
|
@@ -770,7 +852,7 @@ class PythonDependencyPackager(
|
|
|
770
852
|
check_type(argname="argument path", value=path, expected_type=type_hints["path"])
|
|
771
853
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
772
854
|
|
|
773
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromPoetry", [id, path, props]))
|
|
855
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromPoetry", [id, path, props]))
|
|
774
856
|
|
|
775
857
|
@jsii.member(jsii_name="layerFromRequirementsTxt")
|
|
776
858
|
def layer_from_requirements_txt(
|
|
@@ -779,7 +861,7 @@ class PythonDependencyPackager(
|
|
|
779
861
|
path: builtins.str,
|
|
780
862
|
*,
|
|
781
863
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
782
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
864
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
783
865
|
'''(experimental) Create a layer for dependencies defined in requirements.txt and installed with pip.
|
|
784
866
|
|
|
785
867
|
:param id: -
|
|
@@ -794,25 +876,25 @@ class PythonDependencyPackager(
|
|
|
794
876
|
check_type(argname="argument path", value=path, expected_type=type_hints["path"])
|
|
795
877
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
796
878
|
|
|
797
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromRequirementsTxt", [id, path, props]))
|
|
879
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromRequirementsTxt", [id, path, props]))
|
|
798
880
|
|
|
799
881
|
@builtins.property
|
|
800
882
|
@jsii.member(jsii_name="connections")
|
|
801
|
-
def connections(self) -> _aws_cdk_aws_ec2_ceddda9d.Connections:
|
|
883
|
+
def connections(self) -> "_aws_cdk_aws_ec2_ceddda9d.Connections":
|
|
802
884
|
'''(experimental) The network connections associated with this resource.
|
|
803
885
|
|
|
804
886
|
:stability: experimental
|
|
805
887
|
'''
|
|
806
|
-
return typing.cast(_aws_cdk_aws_ec2_ceddda9d.Connections, jsii.get(self, "connections"))
|
|
888
|
+
return typing.cast("_aws_cdk_aws_ec2_ceddda9d.Connections", jsii.get(self, "connections"))
|
|
807
889
|
|
|
808
890
|
@builtins.property
|
|
809
891
|
@jsii.member(jsii_name="grantPrincipal")
|
|
810
|
-
def grant_principal(self) -> _aws_cdk_aws_iam_ceddda9d.IPrincipal:
|
|
892
|
+
def grant_principal(self) -> "_aws_cdk_aws_iam_ceddda9d.IPrincipal":
|
|
811
893
|
'''(experimental) The principal to grant permissions to.
|
|
812
894
|
|
|
813
895
|
:stability: experimental
|
|
814
896
|
'''
|
|
815
|
-
return typing.cast(_aws_cdk_aws_iam_ceddda9d.IPrincipal, jsii.get(self, "grantPrincipal"))
|
|
897
|
+
return typing.cast("_aws_cdk_aws_iam_ceddda9d.IPrincipal", jsii.get(self, "grantPrincipal"))
|
|
816
898
|
|
|
817
899
|
|
|
818
900
|
@jsii.implements(_aws_cdk_aws_iam_ceddda9d.IGrantable, _aws_cdk_aws_ec2_ceddda9d.IConnectable)
|
|
@@ -830,28 +912,28 @@ class RubyDependencyPackager(
|
|
|
830
912
|
|
|
831
913
|
def __init__(
|
|
832
914
|
self,
|
|
833
|
-
scope: _constructs_77d1e7e8.Construct,
|
|
915
|
+
scope: "_constructs_77d1e7e8.Construct",
|
|
834
916
|
id: builtins.str,
|
|
835
917
|
*,
|
|
836
|
-
architecture: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Architecture] = None,
|
|
837
|
-
log_removal_policy: typing.Optional[_aws_cdk_ceddda9d.RemovalPolicy] = None,
|
|
838
|
-
log_retention: typing.Optional[_aws_cdk_aws_logs_ceddda9d.RetentionDays] = None,
|
|
918
|
+
architecture: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Architecture"] = None,
|
|
919
|
+
log_removal_policy: typing.Optional["_aws_cdk_ceddda9d.RemovalPolicy"] = None,
|
|
920
|
+
log_retention: typing.Optional["_aws_cdk_aws_logs_ceddda9d.RetentionDays"] = None,
|
|
839
921
|
preinstall_commands: typing.Optional[typing.Sequence[builtins.str]] = None,
|
|
840
|
-
runtime: typing.Optional[_aws_cdk_aws_lambda_ceddda9d.Runtime] = None,
|
|
841
|
-
subnet_selection: typing.Optional[typing.Union[_aws_cdk_aws_ec2_ceddda9d.SubnetSelection, typing.Dict[builtins.str, typing.Any]]] = None,
|
|
842
|
-
type: typing.Optional[DependencyPackagerType] = None,
|
|
843
|
-
vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
|
|
922
|
+
runtime: typing.Optional["_aws_cdk_aws_lambda_ceddda9d.Runtime"] = None,
|
|
923
|
+
subnet_selection: typing.Optional[typing.Union["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection", typing.Dict[builtins.str, typing.Any]]] = None,
|
|
924
|
+
type: typing.Optional["DependencyPackagerType"] = None,
|
|
925
|
+
vpc: typing.Optional["_aws_cdk_aws_ec2_ceddda9d.IVpc"] = None,
|
|
844
926
|
) -> None:
|
|
845
927
|
'''
|
|
846
928
|
:param scope: -
|
|
847
929
|
:param id: -
|
|
848
930
|
:param architecture: (experimental) Target Lambda architecture. Packages will be installed for this architecture so make sure it fits your Lambda functions.
|
|
849
|
-
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way
|
|
931
|
+
:param log_removal_policy: (experimental) Removal policy for logs of image builds. If deployment fails on the custom resource, try setting this to ``RemovalPolicy.RETAIN``. This way logs can still be viewed, and you can see why the build failed. We try to not leave anything behind when removed. But sometimes a log staying behind is useful. Default: RemovalPolicy.DESTROY
|
|
850
932
|
:param log_retention: (experimental) The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to ``INFINITE``. Default: logs.RetentionDays.ONE_MONTH
|
|
851
933
|
:param preinstall_commands: (experimental) Additional commands to run before installing packages. Use this to authenticate your package repositories like CodeArtifact. Default: []
|
|
852
934
|
:param runtime: (experimental) Target Lambda runtime. Packages will be installed for this runtime so make sure it fits your Lambda functions.
|
|
853
935
|
:param subnet_selection: (experimental) VPC subnets used for packager. Default: default subnets, if VPC is used
|
|
854
|
-
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA}
|
|
936
|
+
:param type: (experimental) Type of dependency packager. Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions. Default: {@link DependencyPackagerType.LAMBDA }
|
|
855
937
|
:param vpc: (experimental) VPC used for packager. Use this if your package repositories are only available from within a VPC. Default: no VPC
|
|
856
938
|
|
|
857
939
|
:stability: experimental
|
|
@@ -880,7 +962,7 @@ class RubyDependencyPackager(
|
|
|
880
962
|
path: builtins.str,
|
|
881
963
|
*,
|
|
882
964
|
always_rebuild: typing.Optional[builtins.bool] = None,
|
|
883
|
-
) -> _aws_cdk_aws_lambda_ceddda9d.LayerVersion:
|
|
965
|
+
) -> "_aws_cdk_aws_lambda_ceddda9d.LayerVersion":
|
|
884
966
|
'''(experimental) Create a layer for dependencies defined in Gemfile and (optionally) Gemfile.lock and installed with Bundler.
|
|
885
967
|
|
|
886
968
|
:param id: -
|
|
@@ -895,25 +977,25 @@ class RubyDependencyPackager(
|
|
|
895
977
|
check_type(argname="argument path", value=path, expected_type=type_hints["path"])
|
|
896
978
|
props = LayerProps(always_rebuild=always_rebuild)
|
|
897
979
|
|
|
898
|
-
return typing.cast(_aws_cdk_aws_lambda_ceddda9d.LayerVersion, jsii.invoke(self, "layerFromBundler", [id, path, props]))
|
|
980
|
+
return typing.cast("_aws_cdk_aws_lambda_ceddda9d.LayerVersion", jsii.invoke(self, "layerFromBundler", [id, path, props]))
|
|
899
981
|
|
|
900
982
|
@builtins.property
|
|
901
983
|
@jsii.member(jsii_name="connections")
|
|
902
|
-
def connections(self) -> _aws_cdk_aws_ec2_ceddda9d.Connections:
|
|
984
|
+
def connections(self) -> "_aws_cdk_aws_ec2_ceddda9d.Connections":
|
|
903
985
|
'''(experimental) The network connections associated with this resource.
|
|
904
986
|
|
|
905
987
|
:stability: experimental
|
|
906
988
|
'''
|
|
907
|
-
return typing.cast(_aws_cdk_aws_ec2_ceddda9d.Connections, jsii.get(self, "connections"))
|
|
989
|
+
return typing.cast("_aws_cdk_aws_ec2_ceddda9d.Connections", jsii.get(self, "connections"))
|
|
908
990
|
|
|
909
991
|
@builtins.property
|
|
910
992
|
@jsii.member(jsii_name="grantPrincipal")
|
|
911
|
-
def grant_principal(self) -> _aws_cdk_aws_iam_ceddda9d.IPrincipal:
|
|
993
|
+
def grant_principal(self) -> "_aws_cdk_aws_iam_ceddda9d.IPrincipal":
|
|
912
994
|
'''(experimental) The principal to grant permissions to.
|
|
913
995
|
|
|
914
996
|
:stability: experimental
|
|
915
997
|
'''
|
|
916
|
-
return typing.cast(_aws_cdk_aws_iam_ceddda9d.IPrincipal, jsii.get(self, "grantPrincipal"))
|
|
998
|
+
return typing.cast("_aws_cdk_aws_iam_ceddda9d.IPrincipal", jsii.get(self, "grantPrincipal"))
|
|
917
999
|
|
|
918
1000
|
|
|
919
1001
|
__all__ = [
|
|
@@ -0,0 +1,45 @@
|
|
|
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 constructs._jsii
|
|
33
|
+
|
|
34
|
+
__jsii_assembly__ = jsii.JSIIAssembly.load(
|
|
35
|
+
"@cloudsnorkel/cdk-turbo-layers",
|
|
36
|
+
"0.3.1",
|
|
37
|
+
__name__[0:-6],
|
|
38
|
+
"cdk-turbo-layers@0.3.1.jsii.tgz",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"__jsii_assembly__",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
publication.publish()
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cloudsnorkel.cdk-turbo-layers
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Speed-up Lambda function deployment with dependency layers built in AWS
|
|
5
5
|
Home-page: https://github.com/CloudSnorkel/cdk-turbo-layers.git
|
|
6
6
|
Author: Amir Szekely<amir@cloudsnorkel.com>
|
|
@@ -10,17 +10,20 @@ Classifier: Intended Audience :: Developers
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: JavaScript
|
|
12
12
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
16
|
Classifier: Typing :: Typed
|
|
19
17
|
Classifier: Development Status :: 4 - Beta
|
|
20
18
|
Classifier: License :: OSI Approved
|
|
21
|
-
Requires-Python: ~=3.
|
|
19
|
+
Requires-Python: ~=3.9
|
|
22
20
|
Description-Content-Type: text/markdown
|
|
23
21
|
License-File: LICENSE
|
|
22
|
+
Requires-Dist: aws-cdk-lib<3.0.0,>=2.146.0
|
|
23
|
+
Requires-Dist: constructs<11.0.0,>=10.0.5
|
|
24
|
+
Requires-Dist: jsii<2.0.0,>=1.126.0
|
|
25
|
+
Requires-Dist: publication>=0.0.3
|
|
26
|
+
Requires-Dist: typeguard==2.13.3
|
|
24
27
|
|
|
25
28
|
# Turbo Layers for CDK
|
|
26
29
|
|
|
@@ -107,7 +110,9 @@ The best way to browse API documentation is on [Constructs Hub](https://construc
|
|
|
107
110
|
dotnet add package CloudSnorkel.Cdk.TurboLayers
|
|
108
111
|
```
|
|
109
112
|
|
|
110
|
-
##
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
The very basic example below will create a layer with dependencies specified as parameters and attach it to a Lambda function.
|
|
111
116
|
|
|
112
117
|
```python
|
|
113
118
|
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
@@ -121,15 +126,77 @@ new Function(this, 'Function with inline requirements', {
|
|
|
121
126
|
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
|
|
122
127
|
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
|
|
123
128
|
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The next example will create a layer with dependencies specified in a `requirements.txt` file and attach it to a Lambda function.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
135
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
136
|
+
type: DependencyPackagerType.LAMBDA,
|
|
137
|
+
});
|
|
124
138
|
new Function(this, 'Function with external source and requirements', {
|
|
125
139
|
handler: 'index.handler',
|
|
126
140
|
code: lambda.Code.fromAsset('lambda-src'),
|
|
127
141
|
runtime: lambda.Runtime.PYTHON_3_9,
|
|
142
|
+
// this will read requirements.txt and create a layer from the requirements in a Lambda function instead of locally
|
|
143
|
+
layers: [packager.layerFromRequirementsTxt('requirements.txt', 'lambda-src')],
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Custom package managers like Pipenv or Poetry are also supported.
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
151
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
152
|
+
type: DependencyPackagerType.LAMBDA,
|
|
153
|
+
});
|
|
154
|
+
new Function(this, 'Function with external source and requirements', {
|
|
155
|
+
handler: 'index.handler',
|
|
156
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
157
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
128
158
|
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
|
|
129
|
-
layers: [packager.layerFromPoetry('poetry
|
|
159
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
130
160
|
});
|
|
131
161
|
```
|
|
132
162
|
|
|
163
|
+
If your dependencies have some C library dependencies, you may need to use the more capable but slower CodeBuild packager.
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
167
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
168
|
+
type: DependencyPackagerType.CODEBUILD,
|
|
169
|
+
preinstallCommands: [
|
|
170
|
+
'apt install -y libxml2-dev libxslt-dev libffi-dev libssl-dev',
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
new Function(this, 'Function with external source and requirements', {
|
|
174
|
+
handler: 'index.handler',
|
|
175
|
+
code: lambda.Code.fromAsset('lambda-pipenv-src'),
|
|
176
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
177
|
+
layers: [packager.layerFromPipenv('pipenv dependencies', 'lambda-pipenv-src')],
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Building layers for ARM64 functions is also supported.
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
const packager = new PythonDependencyPackager(this, 'Packager', {
|
|
185
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
186
|
+
type: DependencyPackagerType.LAMBDA,
|
|
187
|
+
architecture: Architecture.ARM_64,
|
|
188
|
+
});
|
|
189
|
+
new Function(this, 'Function with external source and requirements', {
|
|
190
|
+
handler: 'index.handler',
|
|
191
|
+
code: lambda.Code.fromAsset('lambda-poetry-src'),
|
|
192
|
+
runtime: lambda.Runtime.PYTHON_3_9,
|
|
193
|
+
architecture: Architecture.ARM_64,
|
|
194
|
+
layers: [packager.layerFromPoetry('poetry dependencies', 'lambda-poetry-src')],
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
All these examples are for Python, but the same API is available for Node.js, Ruby, and Java. The same build options are available. Multiple different package managers are supported. See [Constructs Hub](https://constructs.dev/packages/@cloudsnorkel/cdk-turbo-layers/) for more details.
|
|
199
|
+
|
|
133
200
|
## Older Implementations
|
|
134
201
|
|
|
135
202
|
* [lovage](https://github.com/CloudSnorkel/lovage): standalone Python framework that uses the same trick to deploy decorated functions to AWS
|
|
@@ -11,4 +11,4 @@ src/cloudsnorkel.cdk_turbo_layers.egg-info/top_level.txt
|
|
|
11
11
|
src/cloudsnorkel/cdk_turbo_layers/__init__.py
|
|
12
12
|
src/cloudsnorkel/cdk_turbo_layers/py.typed
|
|
13
13
|
src/cloudsnorkel/cdk_turbo_layers/_jsii/__init__.py
|
|
14
|
-
src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.1.
|
|
14
|
+
src/cloudsnorkel/cdk_turbo_layers/_jsii/cdk-turbo-layers@0.3.1.jsii.tgz
|
|
@@ -1,27 +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 constructs._jsii
|
|
15
|
-
|
|
16
|
-
__jsii_assembly__ = jsii.JSIIAssembly.load(
|
|
17
|
-
"@cloudsnorkel/cdk-turbo-layers",
|
|
18
|
-
"0.1.0",
|
|
19
|
-
__name__[0:-6],
|
|
20
|
-
"cdk-turbo-layers@0.1.0.jsii.tgz",
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
__all__ = [
|
|
24
|
-
"__jsii_assembly__",
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
publication.publish()
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|