7
7
This guide is based on [ this article] ( https://medium.com/@skalyani103/python-on-aws-lambda-using-docker-images-5740664c54ca )
8
8
9
9
10
- ## Upload Docker image on ECR and Lambda
10
+
11
+ ## Create an AWS Lambda Function for chDB
12
+
13
+ To create an AWS Lambda function, log into your AWS console.
14
+
15
+ ➡ ** Build & Push** the latest [ chDB-lambda container] ( https://github.com/chdb-io/chdb-server/tree/main/lambda ) image to your ** ECR** storage.
16
+
17
+ ### Upload Docker image on ECR and Lambda
11
18
Lambda function continers must be hosted on the AWS Elastic Container Registry.
12
19
13
20
1 . Export your AWS account id in the shell or better yet, add it your ~ /.bashrc or ~ /.bash_profile
@@ -25,7 +32,42 @@ $ aws configure
25
32
$ ./deploy.sh
26
33
```
27
34
28
- 4 . Create Lambda function and attach your ECR Image
29
35
30
- 5 . Test your Lambda function:
36
+
37
+ ➡ Search for ** AWS Lambda** and select the service. Then, click ** Create Function** .
38
+
39
+ <img src =" https://images.ctfassets.net/o7xu9whrs0u9/5XE0x5uBoOA4oJYZFwzNea/79493c8495c8d60c726cfeeae73a2b84/create_function.png " align =" left " >
40
+
41
+ ➡ Choose ** Container Image** and use the ** chDB ECR** instance URI you created
42
+
43
+ <img src =" https://user-images.githubusercontent.com/1423657/250210923-887894c3-35ef-4083-a4b8-29d247f1fc1c.png " align =" left " >
44
+
45
+
46
+
47
+ ➡ Click ** Create Function** at the bottom right when you’re done.
48
+
49
+ <br >
50
+
51
+ ### Validation
52
+
53
+ Let's ** test** our new ** chDB Lambda** using a * simple query.*
54
+
55
+ The Lamba expects JSON requests with a ** query** key:
56
+
57
+ ``` plaintext
58
+ {
59
+ 'query': 'SELECT version()',
60
+ 'default_format': 'CSV'
61
+ }
62
+ ```
63
+
64
+ And the response would look like this (or any other format)
65
+
66
+ ``` plaintext
67
+ 22.12.1.1
68
+ ```
69
+
70
+ You can also use the Browser and the AWS Console to generate ** test events** :
71
+
72
+ <img src =" https://user-images.githubusercontent.com/1423657/250201531-daa26b0b-68e2-4cec-b665-5505efe99b99.png " align =" left " >
31
73
0 commit comments