{"id":18573156,"url":"https://github.com/localstack-samples/sample-rust-lambda","last_synced_at":"2025-04-10T07:31:50.496Z","repository":{"id":225228981,"uuid":"765275557","full_name":"localstack-samples/sample-rust-lambda","owner":"localstack-samples","description":"Sample Rust Lambda","archived":true,"fork":false,"pushed_at":"2024-02-29T22:03:17.000Z","size":194,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T14:44:42.494Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localstack-samples.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-29T16:00:19.000Z","updated_at":"2024-10-29T03:33:42.000Z","dependencies_parsed_at":"2024-02-29T22:52:37.456Z","dependency_job_id":null,"html_url":"https://github.com/localstack-samples/sample-rust-lambda","commit_stats":null,"previous_names":["localstack-samples/sample-rust-lambda"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-rust-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-rust-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-rust-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-rust-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack-samples","download_url":"https://codeload.github.com/localstack-samples/sample-rust-lambda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248176387,"owners_count":21060058,"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":[],"created_at":"2024-11-06T23:08:14.708Z","updated_at":"2025-04-10T07:31:50.229Z","avatar_url":"https://github.com/localstack-samples.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Rest AWS Lambda\nSee the AWS docs [here](https://docs.aws.amazon.com/lambda/latest/dg/lambda-rust.html) for more information on creating Rust Lambdas.\n![AWS Rust Lambda Design](./docs/design.drawio.png)\n\n## Prerequisites\n1. Docker Desktop is running\n2. LocalStack Pro auth token is set in the environment variable LOCALSTACK_AUTH_TOKEN\n\n## Setup\nCreate a file name .env-gdc-local and add the following to it:\n```bash\nexport LOCALSTACK_AUTH_TOKEN=\u003cyour LocalStack auth token\u003e\n```\n\n## Either run a GDC or LocalStack \n### Run LocalStack without GDC\n```bash\nmake start-localstack\n```\n\nOR\n\n### Run a GDC in the root of the repo.\nRun a GDC (generic dev container) in the root of the repo.\n1. Clone this [GDC](https://github.com/devxpod/GDC)\n2. Run the GDC\n```bash\n\u003cpath to GDC\u003e/run-dev-container.sh\n```\n3. Connect to the GDC\n```bash\ndocker exec -it rls-dev-1 bash -l\n```\n\nBuilding for lambda requires more libs be installed into the GDC to cross-compile the Rust binary.\nUse the makefile target init-rust to install the necessary libs.\nIf you're running on a Mac and not in a GDC, you will have to put `sudo` in front of this make command.\n\n```bash\nmake init-rust\n```\n\n## Build\n```bash\nmake all\n```\n\n## Deploy to AWS or LocalStack\n### Prerequisites\nSet the AWS_ACCT variable in the makefile to the account number of the AWS account you want to deploy to.\nAWS Account Number is defaulted to the LocalStack default account number.\nSetup a profile in your ~/.aws/credentials file with the necessary permissions to create a lambda function.\nTo use a LocalStack profile, create it and set AWS_PROFILE like this [LocalStack AWS Profile](https://docs.localstack.cloud/user-guide/integrations/aws-cli/#configuring-a-custom-profile)\n\n### Set AWS_PROFILE\nIf you are using LocalStack, set the AWS_PROFILE environment variable to the LocalStack profile.\nOtherwise, set it to the profile in your ~/.aws/credentials file for your live AWS account.\n```bash\nexport AWS_PROFILE=localstack\n```\n\n### Create Lambda Role\n```bash\nmake create-lambda-role\n```\n\n### Deploy\nAssume a role with the necessary permissions to create a lambda function.\n```bash\nmake create-lambda-function\n```\n\n### Run integration tests\nIn the Ubuntu dev container, you probably have to run this twice. There is some issue with Rust compilation\non the Ubuntu dev container here. It doesn't happen on Mac and Windows. \n```bash\nmake test\n```\n\n## Clean up\n```bash\nmake delete-lambda\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-rust-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack-samples%2Fsample-rust-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-rust-lambda/lists"}