Skip to content
GitHub Discord

AWS Bun Elysia container

Deploys a Bun Elysia API to AWS.

You can get started by running.

Terminal window
bun create elysia aws-bun-elysia
cd aws-bun-elysia
bunx sst init

Now you can add a service.

sst.config.ts
new sst.aws.Service("MyService", {
cluster,
loadBalancer: {
ports: [{ listen: "80/http", forward: "3000/http" }],
},
dev: {
command: "bun dev",
},
});

Start your app locally.

Terminal window
bun sst dev

This example lets you upload a file to S3 and then download it.

Terminal window
curl -F file=@elysia.png http://localhost:3000/
curl http://localhost:3000/latest

Finally, you can deploy it using bun sst deploy --stage production.

sst.config.ts
const bucket = new sst.aws.Bucket("MyBucket");
const vpc = new sst.aws.Vpc("MyVpc");
const cluster = new sst.aws.Cluster("MyCluster", { vpc });
new sst.aws.Service("MyService", {
cluster,
loadBalancer: {
ports: [{ listen: "80/http", forward: "3000/http" }],
},
dev: {
command: "bun dev",
},
link: [bucket],
});

View the full example.