{"id":13834357,"url":"https://github.com/aws-samples/serverless-rust-demo","last_synced_at":"2025-07-10T04:31:52.167Z","repository":{"id":38342116,"uuid":"409479628","full_name":"aws-samples/serverless-rust-demo","owner":"aws-samples","description":"Sample serverless application written in Rust","archived":false,"fork":false,"pushed_at":"2024-12-16T08:30:29.000Z","size":215,"stargazers_count":284,"open_issues_count":5,"forks_count":28,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-06-05T08:20:54.133Z","etag":null,"topics":["lambda","rust","serverless"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-23T06:47:16.000Z","updated_at":"2025-05-04T16:36:43.000Z","dependencies_parsed_at":"2022-07-09T03:47:13.191Z","dependency_job_id":null,"html_url":"https://github.com/aws-samples/serverless-rust-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aws-samples/serverless-rust-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fserverless-rust-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fserverless-rust-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fserverless-rust-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fserverless-rust-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws-samples","download_url":"https://codeload.github.com/aws-samples/serverless-rust-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-samples%2Fserverless-rust-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264528739,"owners_count":23623217,"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","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":["lambda","rust","serverless"],"created_at":"2024-08-04T14:00:30.866Z","updated_at":"2025-07-10T04:31:51.866Z","avatar_url":"https://github.com/aws-samples.png","language":"Rust","funding_links":[],"categories":["💻 Samples"],"sub_categories":[],"readme":"## Serverless Rust Demo\n\n![build](https://github.com/aws-samples/serverless-rust-demo/actions/workflows/ci.yml/badge.svg)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"imgs/diagram.png\" alt=\"Architecture diagram\"/\u003e\n\u003c/p\u003e\n\nThis is a simple serverless application built in Rust. It consists of an API Gateway backed by four Lambda functions and a DynamoDB table for storage.\n\nThis single crate will create [five different binaries](./src/bin), one for each Lambda function. It uses an [hexagonal architecture pattern](https://aws.amazon.com/blogs/compute/developing-evolutionary-architecture-with-aws-lambda/) to decouple the [entry points](./src/entrypoints/), from the main [domain logic](./src/lib.rs), the [storage component](./src/store), and the [event bus component](./src/event_bus).\n\n## 🏗️ Deployment and testing\n\n### Requirements\n\n* [Rust](https://www.rust-lang.org/) 1.56.0 or higher\n* [cargo-lambda](https://github.com/calavera/cargo-lambda)\n* [Zig](https://ziglang.org/) for cross-compilation (cargo-lambda will prompt you to install it if it's missing in your host system)\n* The [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) 1.33.0 or higher for deploying to the cloud\n* [Artillery](https://artillery.io/) for load-testing the application\n\n### Commands\n\nYou can use the following commands at the root of this repository to test, build, and deploy this project:\n\n```bash\n# Optional: check if tools are installed\nmake setup\n\n# Run unit tests\nmake tests-unit\n\n# Compile and prepare Lambda functions\nmake build\n\n# Deploy the functions on AWS\nmake deploy\n\n# Run integration tests against the API in the cloud\nmake tests-integ\n```\n\n## Load Test\n\n[Artillery](https://www.artillery.io/) is used to make 300 requests / second for 10 minutes to our API endpoints. You can run this\nwith the following command:\n\n```bash\nmake tests-load\n```\n\n### CloudWatch Logs Insights\n\nUsing this CloudWatch Logs Insights query you can analyse the latency of the requests made to the Lambda functions.\n\nThe query separates cold starts from other requests and then gives you p50, p90 and p99 percentiles.\n\n```\nfilter @type=\"REPORT\"\n| fields greatest(@initDuration, 0) + @duration as duration, ispresent(@initDuration) as coldStart\n| stats count(*) as count, pct(duration, 50) as p50, pct(duration, 90) as p90, pct(duration, 99) as p99, max(duration) as max by coldStart\n```\n\n![Load Test Results](imgs/load-test.png)\n\n## 🦀 Getting started with Rust on Lambda\n\nIf you want to get started with Rust on Lambda, you can use [these cookiecutter templates](https://github.com/aws-samples/cookiecutter-aws-sam-rust) to setup your project.\n\n## 👀 With other languages\n\nYou can find implementations of this project in other languages here:\n\n* [🐿️ Go](https://github.com/aws-samples/serverless-go-demo)\n* [⭐ Groovy](https://github.com/aws-samples/serverless-groovy-demo)\n* [☕ Java with GraalVM](https://github.com/aws-samples/serverless-graalvm-demo)\n* [🤖 Kotlin](https://github.com/aws-samples/serverless-kotlin-demo)\n* [🏗️ TypeScript](https://github.com/aws-samples/serverless-typescript-demo)\n* [🥅 .NET](https://github.com/aws-samples/serverless-dotnet-demo)\n\n## Security\n\nSee [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## License\n\nThis library is licensed under the MIT-0 License. See the LICENSE file.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-samples%2Fserverless-rust-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws-samples%2Fserverless-rust-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-samples%2Fserverless-rust-demo/lists"}