Skip to content

Commit b062d6a

Browse files
authored
Update README.md
1 parent c7b2ad6 commit b062d6a

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

README.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
This guide is based on [this article](https://medium.com/@skalyani103/python-on-aws-lambda-using-docker-images-5740664c54ca)
88

99

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
1118
Lambda function continers must be hosted on the AWS Elastic Container Registry.
1219

1320
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
2532
$ ./deploy.sh
2633
```
2734

28-
4. Create Lambda function and attach your ECR Image
2935

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">
3173

0 commit comments

Comments
 (0)