1# Drizzle + Aurora DSQL + Lambda
2
3[Integration guide](https://alchemy.run/aws/data/drizzle-dsql/) · [AWS setup](https://alchemy.run/aws/setup/)
4
5## Deploy
6
7From the repository root:
8
9```sh
10pnpm install
11cd examples/aws-dsql-drizzle
12pnpm deploy --profile testing
13```
14
15Use a DSQL region such as `us-west-2`. Deployment needs `dsql:DbConnectAdmin` and network access to port 5432; these resources incur AWS charges.
16
17## Query
18
19```sh
20aws lambda invoke --region us-west-2 \
21 --function-name '<functionName>' \
22 --cli-binary-format raw-in-base64-out \
23 --payload file://health-event.json response.json
24cat response.json
25```
26
27Use the printed function name. [Signed HTTP CRUD examples](./test/integ.test.ts).
28
29## Schema and connections
30
31[Cluster](./src/database.ts) · [Deployment-only bootstrap](./src/bootstrap.ts) · [Non-admin connection and verified TLS](./src/client.ts)
32
33Initial setup creates `app.todos` and `app_user`. Later schema changes need versioned, [DSQL-compatible migrations](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-postgresql-compatibility.html).
34
35## Live test
36
37```sh
38ALCHEMY_PROFILE=testing bun test test/integ.test.ts
39```
40
41## Destroy
42
43```sh
44pnpm destroy --profile testing
45aws dsql get-cluster --region us-west-2 --identifier '<clusterId>'
46```
47
48Destroy deletes the database data. Deletion is asynchronous; wait for `DELETED` or `ResourceNotFoundException`.