Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TotalTechGeek/elysia-lambda
A plugin for Elysia to deploy to AWS Lambda
https://github.com/TotalTechGeek/elysia-lambda
Last synced: about 1 month ago
JSON representation
A plugin for Elysia to deploy to AWS Lambda
- Host: GitHub
- URL: https://github.com/TotalTechGeek/elysia-lambda
- Owner: TotalTechGeek
- License: mit
- Created: 2023-04-29T18:27:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-14T07:21:40.000Z (10 months ago)
- Last Synced: 2024-11-07T23:56:32.057Z (about 1 month ago)
- Language: JavaScript
- Size: 92.8 KB
- Stars: 31
- Watchers: 6
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-elysia - Lambda - Deploy on AWS Lambda. (Plugins)
README
# elysia-lambda
This plugin for Elysia attempts to make it easier to deploy your Elysia project to AWS Lambda.
## Installation
```bash
bun install elysia-lambda
```In your application, you will add the following to your code:
```typescript
import { Elysia } from 'elysia'
import { lambda } from 'elysia-lambda'const app = new Elysia()
.use(lambda())
```This is all you need to do to install the plugin into your codebase.
## Usage
We strongly recommend running the init command,
```bash
bunx elysia-lambda --init
```This will guide you through the process of setting up your project for deployment to AWS Lambda, and setting up the official Bun layer.
This application expects that you are configured with sufficient AWS CLI Permissions.
After the init command has been performed, you will have a yaml file for your lambda deployment and a `deploy` script added to your `package.json`.
The configuration file will look like the following:
```yaml
deploy: src/index.ts
name: ElysiaLambda
region: us-east-1
arch: arm64
description: An Elysia Lambda app.
role: arn:aws:iam::672112969134:role/TestLambda
layers:
- arn:aws:lambda:us-east-1:672112969134:layer:bun:8
environment:
SomeEnvVariable: SomeValue
memory: 256
```Alternatively, it is possible to run the tool exclusively from the CLI:
```txt
Usage: elysia-lambda [options]Options:
--init Begin the setup to deploy to Lambda.
--deploy Deploy to AWS
--build Build for AWS
-o, --out Where to output the build zip.
-r, --region AWS region to deploy to.
--role AWS role to attach to the lambda.
--name Name of the lambda.
--layers AWS layers to attach to the lambda.
-c , --config Path to a yaml/json config file.
--description Description of the lambda.
--memory Memory to allocate to the lambda, in MiB. (default: "128")
--arch AWS architecture to deploy to. (choices: "arm64", "x64")
-h, --help display help for command
```After adding a deploy script to your `package.json`, you can run the following command to deploy your application:
```bash
bun run deploy
```This will build your application and deploy it to AWS Lambda.
### Demo
https://user-images.githubusercontent.com/2261916/235324906-17f1fdcf-d61a-487e-b498-595e7f94c836.mp4
### NotesThe deployment script requires Bun versions newer than `0.6.0`.
I may add support for ESBuild & the Elysia Node.js Polyfills in the future.