{"id":19502351,"url":"https://github.com/zio/zio-lambda","last_synced_at":"2026-02-25T00:12:57.258Z","repository":{"id":34964829,"uuid":"380034677","full_name":"zio/zio-lambda","owner":"zio","description":"AWS Lambda Runtime built with ZIO","archived":false,"fork":false,"pushed_at":"2025-05-01T04:06:34.000Z","size":301,"stargazers_count":40,"open_issues_count":16,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-19T11:58:52.516Z","etag":null,"topics":["aws-lambda","scala","zio"],"latest_commit_sha":null,"homepage":"https://zio.dev/zio-lambda","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-06-24T19:47:41.000Z","updated_at":"2025-05-01T04:06:37.000Z","dependencies_parsed_at":"2025-04-26T00:31:56.825Z","dependency_job_id":"1ebfe1b1-ca90-43da-a62b-8d1d53a34208","html_url":"https://github.com/zio/zio-lambda","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/zio/zio-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zio","download_url":"https://codeload.github.com/zio/zio-lambda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272124753,"owners_count":24877720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","scala","zio"],"created_at":"2024-11-10T22:16:09.511Z","updated_at":"2026-02-25T00:12:57.246Z","avatar_url":"https://github.com/zio.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[//]: # (This file was autogenerated using `zio-sbt-website` plugin via `sbt generateReadme` command.)\n[//]: # (So please do not edit it manually. Instead, change \"docs/index.md\" file or sbt setting keys)\n[//]: # (e.g. \"readmeDocumentation\" and \"readmeSupport\".)\n\n# ZIO Lambda\n\nA ZIO-based AWS Custom Runtime compatible with GraalVM Native Image.\n\n[![Development](https://img.shields.io/badge/Project%20Stage-Development-green.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-lambda/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-lambda_2.13.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-lambda_2.13/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-lambda_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-lambda_2.13/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-lambda-docs_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-lambda-docs_2.13) [![ZIO Lambda](https://img.shields.io/github/stars/zio/zio-lambda?style=social)](https://github.com/zio/zio-lambda)\n\n## Installation\n\n```scala\nlibraryDependencies += \"dev.zio\" %% \"zio-json\" % \"0.6.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-lambda\" % \"1.0.5\"\n\n// Optional dependencies\nlibraryDependencies += \"dev.zio\" %% \"zio-lambda-event\"    % \"1.0.5\"\nlibraryDependencies += \"dev.zio\" %% \"zio-lambda-response\" % \"1.0.5\"\n```\n\n## Usage\n\nCreate your Lambda function by providing it to `ZLambdaRunner.serve(...)` method.\n\n```scala\nimport zio.Console._\nimport zio._\nimport zio.lambda._\n\nobject SimpleHandler extends ZIOAppDefault {\n\n   def app(request: KinesisEvent, context: Context) = for {\n      _ \u003c- printLine(event.message)\n   } yield \"Handler ran successfully\"\n\n   override val run =\n      ZLambdaRunner.serve(app)\n}\n```\n\nzio-lambda depends on [**zio-json**](https://github.com/zio/zio-json) for decoding any event you send to it and enconding any response you send back to the Lambda service. You can either create your own data types or use the ones that are included in **zio-lambda-event** and **zio-lambda-response**.\n\nThe last step is to define the way your function will be invoked. There are three ways, detailed below:\n\n## Lambda layer\n\nUpload zio-lambda as a [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html)\nEach release will contain a zip file ready to be used as a lambda layer) and your function. Instructions coming soon!\n\n## Direct deployment of native image binary\n\n1. Create an AWS Lambda function and choose the runtime where you provide your own bootstrap on Amazon Linux 2\n\n   ![create-lambda](https://user-images.githubusercontent.com/14280155/164102664-3686e415-20be-4dd9-8979-ea6098a7a4b9.png)\n2. Run `sbt GraalVMNativeImage/packageBin`, we'll find the binary present under the `graalvm-native-image` folder:\n\n   ![binary-located](https://user-images.githubusercontent.com/14280155/164103337-6645dfeb-7fc4-4f7f-9b13-8005b0cddead.png)\n\n3. Create the following bootstap file (which calls out to the binary) and place it in the same directory alongside the binary:\n    ```bash\n    #!/usr/bin/env bash\n    \n    set -euo pipefail\n    \n    ./zio-lambda-example\n    ```\n\n   ![bootstrap-alongside-native-binary](https://user-images.githubusercontent.com/14280155/164103935-0bf7a6cb-814d-4de1-8fa1-4d0d54fb6e88.png)\n\n4. Now we can zip both these files up:\n    ```log\n    \u003e pwd\n    /home/cal/IdeaProjects/zio-lambda/lambda-example/target/graalvm-native-image                                                                                                                                \n    \u003e zip upload.zip bootstrap zio-lambda-example\n    ```\n\n5. Take `upload.zip` and upload it to AWS Lambda and test your function:\n\n   ![lambda-ui](https://user-images.githubusercontent.com/14280155/164104747-039ec584-d3e2-4b47-884d-ff88977e2b53.png)\n\n6. Test everything out to make sure everything works:\n\n   ![test-ui](https://user-images.githubusercontent.com/14280155/164104858-a720ac55-b9bb-47ec-af70-c4bd5eb5bed3.png)\n\n## Deployment of native image binary in a Docker container\n\nFollowing the steps from `Direct deployment of native image binary` to produce your native image binary, we can package\nup the native binary into a Docker image and deploy it like that to AWS Lambda.\n\n```Dockerfile\nFROM gcr.io/distroless/base-debian12\nCOPY lambda-example/target/graalvm-native-image/zio-lambda-example /app/zio-lambda-example\nCMD [\"/app/zio-lambda-example\"]\n```\n\n**NOTE:** This Dockerfile is meant to build the lambda-example located in the zio-lambda project and the Dockerfile is\nplaced in the zio-lambda-repository. You will need to adjust this Dockerfile to match your project needs.\n\nNow we can build and tag the Docker image:\n\n```shell\ndocker build -t native-image-binary .\n```\n\nTake this image and push it to AWS ECR:\n\n```bash\npass=$(aws ecr get-login-password --region us-east-1) \ndocker login --username AWS --password $pass \u003cyour_AWS_ECR_REPO\u003e   \ndocker tag native-image-binary \u003cyour-particular-ecr-image-repository\u003e:\u003cyour-tag\u003e\ndocker push \u003cyour-particular-ecr-image-repository\u003e:\u003cyour-tag\u003e\n```\n\nHere is an example:\n\n![image-uploaded](https://user-images.githubusercontent.com/14280155/164120591-68a78d19-c56b-4793-96b8-cfe567443063.png)\n\nCreate a Lambda function and choose container image:\n\n![lambda-create-container-image](https://user-images.githubusercontent.com/14280155/164120637-9c827736-26a8-4c65-92d4-2919157bbda6.png)\n\n![image](https://user-images.githubusercontent.com/14280155/164120764-2c736a46-29e3-488c-ba6a-e2b69ef51792.png)\n\nPlease note that because you incur the overhead of your native binary residing within a Docker container, there is more overhead than the other approach of deploying the binary straight to AWS Lambda\n\n## Documentation\n\nLearn more on the [ZIO Lambda homepage](https://zio.dev/zio-lambda/)!\n\n## Contributing\n\nFor the general guidelines, see ZIO [contributor's guide](https://zio.dev/contributor-guidelines).\n\n## Code of Conduct\n\nSee the [Code of Conduct](https://zio.dev/code-of-conduct)\n\n## Support\n\nCome chat with us on [![Badge-Discord]][Link-Discord].\n\n[Badge-Discord]: https://img.shields.io/discord/629491597070827530?logo=discord \"chat on discord\"\n[Link-Discord]: https://discord.gg/2ccFBr4 \"Discord\"\n\n## License\n\n[License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Fzio-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzio%2Fzio-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Fzio-lambda/lists"}