-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserverless.yml
78 lines (69 loc) · 1.95 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
service: naip-cogeo-mosaic
provider:
name: aws
runtime: python3.7
stage: ${opt:stage, 'production'}
region: "us-west-2"
deploymentBucket: ${opt:bucket}
httpApi:
cors: true
# Add Tags to resources
stackTags:
Project: cogeo
apiGateway:
binaryMediaTypes:
- "*/*"
minimumCompressionSize: 1
# Add other buckets here if needed
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:GetObject"
- "s3:HeadObject"
- "s3:PutObject"
Resource:
- "arn:aws:s3:::${self:provider.deploymentBucket}*"
- Effect: "Allow"
Action:
- "s3:GetObject"
- "s3:HeadObject"
Resource:
- "arn:aws:s3:::*"
- Effect: "Allow"
Action:
- "dynamodb:GetItem"
Resource:
# Allow access to all dynamodb tables in region
- "arn:aws:dynamodb:${self:provider.region}:${opt:aws-account-id, '961053664803'}:table/*"
package:
artifact: cogeo-mosaic-tiler/package.zip
functions:
app:
handler: cogeo_mosaic_tiler.handlers.app.app
memorySize: 1536
timeout: 8
layers:
- arn:aws:lambda:${self:provider.region}:524387336408:layer:gdal24-py37-geolayer:1
environment:
# Necessary since NAIP bucket is requester-pays
AWS_REQUEST_PAYER: requester
CACHE_CONTROL: ${opt:cache-control, 'max-age=3600'}
CPL_TMPDIR: /tmp
CPL_VSIL_CURL_ALLOWED_EXTENSIONS: .tif,.TIF
GDAL_CACHEMAX: 25%
GDAL_DATA: /opt/share/gdal
# https://github.com/OSGeo/gdal/issues/909#issuecomment-420036545
GDAL_DISABLE_READDIR_ON_OPEN: EMPTY_DIR
GDAL_HTTP_MERGE_CONSECUTIVE_RANGES: YES
GDAL_HTTP_MULTIPLEX: YES
GDAL_HTTP_VERSION: 2
MAX_THREADS: 1
MOSAIC_DEF_BUCKET: ${self:provider.deploymentBucket}
PROJ_LIB: /opt/share/proj
PYTHONWARNINGS: ignore
VSI_CACHE: TRUE
VSI_CACHE_SIZE: 536870912
events:
- httpApi:
path: /{proxy+}
method: "*"