Skip to content

Commit 23af601

Browse files
committed
update aws deployment
1 parent 60249da commit 23af601

File tree

5 files changed

+33
-29
lines changed

5 files changed

+33
-29
lines changed

deployment/aws/cdk/app.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
from typing import Any, Dict, List, Optional, Union
55

66
from aws_cdk import App, CfnOutput, Duration, Stack, Tags
7-
from aws_cdk import aws_apigatewayv2_alpha as apigw
7+
from aws_cdk import aws_apigatewayv2 as apigw
88
from aws_cdk import aws_ec2 as ec2
99
from aws_cdk import aws_ecs as ecs
1010
from aws_cdk import aws_ecs_patterns as ecs_patterns
1111
from aws_cdk import aws_iam as iam
1212
from aws_cdk import aws_lambda
1313
from aws_cdk import aws_logs as logs
14-
from aws_cdk.aws_apigatewayv2_integrations_alpha import HttpLambdaIntegration
14+
from aws_cdk.aws_apigatewayv2_integrations import HttpLambdaIntegration
1515
from config import StackSettings
1616
from constructs import Construct
1717

@@ -34,7 +34,7 @@ def __init__(
3434
id: str,
3535
memory: int = 1024,
3636
timeout: int = 30,
37-
runtime: aws_lambda.Runtime = aws_lambda.Runtime.PYTHON_3_11,
37+
runtime: aws_lambda.Runtime = aws_lambda.Runtime.PYTHON_3_12,
3838
concurrent: Optional[int] = None,
3939
permissions: Optional[List[iam.PolicyStatement]] = None,
4040
environment: Optional[Dict] = None,
@@ -54,6 +54,10 @@ def __init__(
5454
code=aws_lambda.Code.from_docker_build(
5555
path=os.path.abspath(code_dir),
5656
file="lambda/Dockerfile",
57+
platform="linux/amd64",
58+
build_args={
59+
"PYTHON_VERSION": "3.12",
60+
},
5761
),
5862
handler="handler.handler",
5963
memory_size=memory,

deployment/aws/lambda/Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
ARG PYTHON_VERSION=3.11
1+
ARG PYTHON_VERSION=3.12
22

33
FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION}
44

55
WORKDIR /tmp
66

77
# Install system dependencies to compile (numexpr)
8-
RUN yum install -y gcc-c++
8+
RUN dnf install -y gcc-c++ && dnf clean all
99

1010
RUN python -m pip install pip -U
1111
RUN python -m pip install "titiler.application==0.22.3" "mangum>=0.10.0" -t /asset --no-binary pydantic
@@ -17,9 +17,11 @@ RUN cd /asset && find . -type f -a -name '*.py' -print0 | xargs -0 rm -f
1717
RUN find /asset -type d -a -name 'tests' -print0 | xargs -0 rm -rf
1818
RUN rm -rdf /asset/numpy/doc/ /asset/boto3* /asset/botocore* /asset/bin /asset/geos_license /asset/Misc
1919

20-
# Remove system dependencies
21-
RUN yum remove -y gcc-c++
22-
2320
COPY lambda/handler.py /asset/handler.py
2421

22+
# Ref: https://github.com/developmentseed/titiler/discussions/1108#discussioncomment-13045681
23+
RUN cp /usr/lib64/libexpat.so.1 /asset/
24+
25+
ENV LAMBDA_TASK_ROOT /asset
26+
2527
CMD ["echo", "hello world"]

deployment/aws/package-lock.json

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment/aws/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"private": true,
77
"dependencies": {
8-
"cdk": "2.94.0"
8+
"cdk": "2.1018.1"
99
},
1010
"scripts": {
1111
"cdk": "cdk"

deployment/aws/requirements-cdk.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# aws cdk
2-
aws-cdk-lib==2.94.0
3-
aws_cdk-aws_apigatewayv2_alpha==2.94.0a0
4-
aws_cdk-aws_apigatewayv2_integrations_alpha==2.94.0a0
2+
aws-cdk-lib==2.201.0
53
constructs>=10.0.0
64

75
# pydantic settings

0 commit comments

Comments
 (0)