Recently, AWS promoted Rust support for its Function as a Service (FaaS) offering, Lambda, from Experimental to Generally Available (GA), enabling developers to build serverless applications with Rust, backed by AWS Support and the Lambda availability SLA.
According to the company, Rust is a popular programming language due to its combination of high performance, memory safety, and developer experience. Moreover, the language offers speed and memory efficiency comparable to C++, along with the reliability typically associated with higher-level languages.
The announcement sparked discussion, started by Serverless Hero Yan Cui on LinkedIn, because Rust compiles to native machine code and does not utilize a traditional managed execution runtime (like Node.js or Python). Benjamin Pyle commented:
The crate is what they are marking official. It handles operations with the Lambda API and is built with Tower. It also has crates for working with AWS Service payloads. There’s an HTTP crate, too, that abstracts working with HTTP events in Rust.
This clarification is critical as the GA status signifies that the core development libraries for building Rust Lambdas are now a supported AWS offering, falling under the full Lambda SLA and Premium Support.
Jess Izen, a Senior Software Engineer at AWS and maintainer of the runtime, noted on LinkedIn:
It’s exciting to see what started as a scrappy, community-driven project reach official status. This comes with SLAs and roadmap support that will give developers confidence to build in Rust on Lambda.
The runtime uses Amazon Linux 2023 (provided.al2023 or provided.al2) since Rust compiles to native machine code rather than requiring a language-specific runtime. Developers can use the lambda_runtime crate for Lambda event processing, and AWS recommends Cargo Lambda, a third-party open-source extension to the cargo command-line tool that simplifies building and deploying Rust Lambda functions.
In an AWS Compute blog post, the authors explain that developers use the cargo lambda build command to build the Lambda function. When compiling, the AWS Lambda Runtime logic (provided by the crate) is compiled directly into the resulting binary, which is named bootstrap. This bootstrap file is then packaged in the function artifact .zip file.
When Lambda executes this binary, it starts an infinite loop (the Run function). This loop polls the Lambda Runtime API to receive the invoke request. Once received, it calls the custom handler function (e.g., function_handler). The function code executes, and the response is then sent back to the Lambda Runtime API, which forwards it to the original caller.
(Source: AWS Compute blog post)
While the performance benefits are clear, community feedback in a Reddit thread highlights a significant trade-off when using the official AWS SDK for Rust. One respondent noted that, despite lightning-fast runtime performance, the time required to compile the full AWS SDK remains a significant obstacle:
This is exciting, but still not something I would recommend until the Rust AWS SDK does something about their compile times.
Additionally, using the official SDK crates (which often include large dependencies like aws-lc-rs for crypto) can substantially increase the final binary size, sometimes by 10MB or more, impacting deployment speed. While AWS and the community explore solutions (such as lazy compilation hints), developers should be aware that using the full AWS SDK will introduce considerable friction into the Rust development loop.
Lastly, more details are available on the documentation pages, and the Lambda support for Rust is available in all AWS Regions, including the AWS GovCloud (US) Regions and the China Regions.
