Run Rust on AWS Lambda

How it used to get done

The last time that I tried to run Rust on AWS Lambda it required that I compile the Rust code into a Python package and then run the Python Lambda target. Now this is unnecessary and much deserved. Rust is a great new language that fits well into the dynamic ecosystem of Serverless Web Programming.

How it works now

To run on AWS it is now only required that the developer include the AWS setup and teardown code into their code, then compile the project into the AWS Linux target. This is all fairly straightforward and much easier to get started with.

#[macro_use] extern crate lambda_runtime as lambda;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate log;
extern crate simple_logger;

use lambda::error::HandlerError;
use std::error::Error;

#[derive(Deserialize, Clone)]
struct HandlerInput {
    name: String,

#[derive(Serialize, Clone)]
struct HandlerOutput {
    message: String,

fn main() -> Result<(), Box<dyn Error>> {


fn my_handler(e: HandlerInput, c: lambda::Context) -> Result<HandlerOutput, HandlerError> {
    Ok(HandlerOutput {
        message: format!("Hello, {}!",,