This repository was archived by the owner on Dec 29, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM public.ecr.aws/lambda/python:latest
2
+ COPY lambda.py ./
3
+ COPY requirements.txt ./
4
+ RUN python3 -m pip install -r requirements.txt
5
+
6
+ CMD ["lambda.lambda_handler" ]
Original file line number Diff line number Diff line change
1
+ # chDB on AWS Lambda
2
+
3
+ > Running chdb in a lambda function for fun a profit!
4
+
5
+ This guide is based on [ this article] ( https://medium.com/@skalyani103/python-on-aws-lambda-using-docker-images-5740664c54ca )
6
+
7
+ ## Upload Docker image on ECR and Lambda
8
+ Lambda function continers must be hosted on the AWS Elastic Container Registry.
9
+
10
+ 1 . Export your AWS account id in the shell or better yet, add it your ~ /.bashrc or ~ /.bash_profile
11
+ ```
12
+ $ export AWS_ACCOUNT_ID = <account_id>
13
+ ```
14
+
15
+ 2 . Install the AWS CLI and configure with your AWS credentials
16
+ ```
17
+ $ aws configure
18
+ ```
19
+
20
+ 3 . Review and execute the ‘deploy.sh’ script:
21
+ ```
22
+ $ ./deploy.sh
23
+ ```
24
+
25
+ 4 . Create Lambda function and attach your ECR Image
26
+
27
+ 5 . Test your Lambda function:
28
+
Original file line number Diff line number Diff line change
1
+ URL_STRING=" .dkr.ecr.us-east-1.amazonaws.com"
2
+ CONTAINER_STRING=" chdb"
3
+ IMAGE_STRING=" latest"
4
+ ECR_IMAGE_URI=" $AWS_ACCOUNT_ID$URL_STRING /$CONTAINER_STRING :$IMAGE_STRING "
5
+ # log in to ECR
6
+ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin " $AWS_ACCOUNT_ID$URL_STRING "
7
+ # remove previous images to save space
8
+ docker rmi " $AWS_ACCOUNT_ID$URL_STRING /$CONTAINER_STRING "
9
+ docker rmi " $CONTAINER_STRING "
10
+ # build image
11
+ docker build --tag " $CONTAINER_STRING " .
12
+ # tag and push to AWS ECR
13
+ docker tag $CONTAINER_STRING :latest " $ECR_IMAGE_URI "
14
+ docker push " $ECR_IMAGE_URI "
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ chdb
You can’t perform that action at this time.
0 commit comments