Skip to content

Commit 36f003e

Browse files
committed
update doc [skip ci]
1 parent ca897ac commit 36f003e

File tree

5 files changed

+378
-65
lines changed

5 files changed

+378
-65
lines changed

README.md

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,25 @@
55
Create an **AWS lambda** like docker images and lambda layer with GDAL.
66

77

8-
## Images
9-
### GDAL - Based on lambci/lambda-base:build
8+
# Docker Images
9+
Based on lambci/lambda-base:build
1010
- 3.1.0 (April. 2020) - **lambgeo/lambda:gdal3.1** - Pre-release
1111
- 3.0.4 (April. 2020) - **lambgeo/lambda:gdal3.0**
1212
- 2.4.4 (April. 2020) - **lambgeo/lambda:gdal2.4**
1313

14-
## Lambda Layers
15-
14+
# Lambda Layers
1615
We are publishing each gdal version as lambda layer on the AWS infrastructure.
1716
Each layer are available for all runtimes.
1817

19-
**gdal${version}**
20-
21-
arn: **arn:aws:lambda:{REGION}:524387336408:layer:gdal${version}**
22-
23-
[Full list of version and ARN](https://github.com/RemotePixel/amazonlinux/blob/master/arns.json)
24-
2518
#### versions:
2619

27-
gdal | version | size (Mb)| unzipped size (Mb)
28-
---| ---| ---| ---
29-
3.1 | 1| 46.4| 136.9
30-
3.0 | 1| 46.4| 136.9
31-
2.4 | 1| 37.7| 126.2
20+
gdal | version | size (Mb)| unzipped size (Mb)| arn
21+
---| ---| ---| ---| ---
22+
3.1 | 1| 24| 61.7| arn:aws:lambda:us-east-1:524387336408:layer:gdal31:1
23+
3.0 | 1| 23| 58.5| arn:aws:lambda:us-east-1:524387336408:layer:gdal30:1
24+
2.4 | 1| 14.8| 48.6| arn:aws:lambda:us-east-1:524387336408:layer:gdal24:1
25+
26+
[Full list of version and ARN](/arns.json)
3227

3328
#### Regions
3429
- ap-northeast-1
@@ -48,35 +43,53 @@ gdal | version | size (Mb)| unzipped size (Mb)
4843
- us-west-1
4944
- us-west-2
5045

51-
### Python - Based on lambci/lambda:build-python*
46+
#### content
47+
48+
```
49+
layer.zip
50+
|
51+
|___ bin/ # Binaries
52+
|___ lib/ # Shared libraries (GDAL, PROJ, GEOS...)
53+
|___ share/ # GDAL/PROJ data directories
54+
```
55+
56+
You may want to extent this layer by adding runtime specific code
57+
58+
```
59+
layer.zip
60+
|
61+
...
62+
|___ python/ # Runtime
63+
|__ rasterio/
64+
|__ rio_tiler/
65+
|__ handler.py
66+
```
5267

53-
Those images are here to help for the creation of lambda package or lambda layer.
68+
## Create a Python Lambda package
69+
70+
To help the creation of lambda Python package (or complex layers) we are also creating Python (3.7 and 3.8) docker images.
5471

5572
- **3.1**
56-
- **lambgeo/lambda:gdal3.1-py3.7**
5773
- **lambgeo/lambda:gdal3.1-py3.8**
74+
- **lambgeo/lambda:gdal3.1-py3.7**
5875

5976
- **3.0**
60-
- **lambgeo/lambda:gdal3.0-py3.7**
6177
- **lambgeo/lambda:gdal3.0-py3.8**
78+
- **lambgeo/lambda:gdal3.0-py3.7**
6279

6380
- **2.4**
64-
- **lambgeo/lambda:gdal2.4-py3.7**
6581
- **lambgeo/lambda:gdal2.4-py3.8**
66-
67-
Content: GDAL Libs and python with numpy and cython
82+
- **lambgeo/lambda:gdal2.4-py3.7**
6883

6984
Checkout [/base/python/Dockerfile](/base/python/Dockerfile) to see how to create other runtime supported images.
7085

71-
# Create a Python Lambda package
72-
7386
You can use the docker container to either build a full package (you provide all the libraries)
7487
or adapt for the use of AWS Lambda layer.
7588

76-
## 1. Create full package (see [/examples/package](/examples/package))
77-
This is like we used to do before (with remotepixel/amazonlinux-gdal images)
89+
### 1. Create full package (see [/examples/package](/examples/package))
90+
91+
- /Dockerfile
7892

79-
- dockerfile
8093
```Dockerfile
8194
FROM lambgeo/lambda:gdal3.0-py3.7
8295

@@ -86,7 +99,8 @@ COPY handler.py ${PACKAGE_PREFIX}/handler.py
8699
RUN pip install numpy rasterio mercantile --no-binary :all: -t ${PACKAGE_PREFIX}/
87100
```
88101

89-
- package.sh
102+
- /package.sh
103+
90104
```bash
91105
#!/bin/bash
92106
echo "-----------------------"
@@ -119,16 +133,16 @@ docker stop lambda
119133
docker rm lambda
120134
```
121135

122-
## 2. Use Lambda Layer (see [/examples/layer](/examples/layer))
136+
### 2. Use Lambda Layer (see [/examples/layer](/examples/layer))
123137

124138
- dockerfile
125139

126-
Here we install rasterio and we add our handler method.
127-
The final package structure should be
140+
Here we install rasterio and we add our handler method. The final package structure should be
128141

129142
```
130143
package/
131144
|___ handler.py
145+
|___ mercantile/
132146
|___ rasterio/
133147
```
134148

@@ -141,8 +155,9 @@ ENV PYTHONUSERBASE=/var/task
141155

142156
# Create a package
143157
COPY handler.py $PYTHONUSERBASE/handler.py
144-
RUN pip install --user rasterio --no-binary rasterio
158+
RUN pip install numpy rasterio mercantile --no-binary :all: --user
145159
```
160+
146161
- layer.sh
147162
```bash
148163
# We move all the package to the root directory
@@ -166,31 +181,7 @@ docker rm lambda
166181

167182
```
168183

169-
# AWS Lambda Layer architecture
170-
171-
The AWS Layer created within this repository have this architecture:
172-
173-
```
174-
layer.zip
175-
|
176-
|___ bin/ # Binaries
177-
|___ lib/ # Shared libraries (GDAL, PROJ, GEOS...)
178-
|___ share/ # GDAL/PROJ data directories
179-
```
180-
181-
You may want to extent this layer by adding runtime specific code
182-
183-
```
184-
layer.zip
185-
|
186-
...
187-
|___ python/ # Runtime
188-
|__ rasterio/
189-
|__ rio_tiler/
190-
|__ handler.py
191-
```
192-
193-
# AWS Lambda config
184+
## AWS Lambda config
194185
- When using lambgeo gdal layer
195186

196187
- **GDAL_DATA:** /opt/share/gdal

0 commit comments

Comments
 (0)