Skip to content
Guide for Creating an AWS Lambda Function using Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Writing AWS Lambda Functions in Rust

AWS Lambda Functions in Rust Build Status MIT License

This repository contains a working example of how to create serverless lambda functions using Rust that can be deployed onto Amazon Web Services.

The project is elaborated in more detail on SilentByte | Writing AWS Lambda Functions in Rust.

Building & Deploying the Project

To build this project, it is required to have Rust/Cargo, NodeJS 12, and Docker installed. Having an AWS account with properly configured access keys is not mandatory for building the project but required for deployment.


  1. Clone this repository.

  2. Install the Serverless Framework: npm install -g serverless.

  3. Within the project directory, run npm install.

  4. Run the following command to build and test the lambda function. This will compile the Rust project and build a Docker image for execution, so it may take a while to complete.

    serverless invoke local -f lucky_numbers -d \
               '{"body": "{\"name\":\"SilentByte\", \"count\": 10}"}'
  5. To deploy the project onto AWS, simply run serverless deploy. If the deployment succeeded, the CLI command will show you the URL of the API endpoint that has been created. You can then test against it using CURL by running:

    curl -X POST \
         -H "Content-Type: application/json" \
         -d '{"name":"SilentByte","count": 10}' \

    With a result that should be similar to this JSON object:

      "message": "Hi, 'SILENTBYTE'. Your lucky numbers are:",
      "numbers": [8, 23, 26, 21, 32, 24, 8, 40, 34, 2]


See LICENSE.txt.

You can’t perform that action at this time.