Skip to content

Feature Request: add Rust support to Powertools for AWS #37

@michaelbrewer

Description

@michaelbrewer
Contributor

Runtime:
Rust

Is your feature request related to a problem? Please describe
In the Serverless Lens for the Well Architected Framework, we suggest several best practices for observability such as structured logging, distributed tracing, and monitoring of metrics. The suite of utilities of the AWS Lambda Powertools help developers with the adoption of best practices.
Today, AWS Lambda Powertools is available for the Python and Java runtimes.

In addition to the powertools the crate, the documentation site can help people new to Rust and AWS Lambda to get up in running

Describe the solution you'd like
AWS Lambda Powertools available for Provided runtimes, written in Rust.

Describe alternatives you've considered
There is almost no alternatives or guidance that i have seen so far.

If you provide guidance, is this something you'd like to contribute?
Absolutely yes.

Additional context
The Rust Powertools will follow the same tenets as the other languages, and folks can expect the same core utilities/ functionalities being supported.

This request is based on #26 :)

Activity

michaelbrewer

michaelbrewer commented on Nov 12, 2021

@michaelbrewer
ContributorAuthor

I assume @nmoutschen you are already running this and have a crate (namespace)

nmoutschen

nmoutschen commented on Nov 12, 2021

@nmoutschen

I assume @nmoutschen you are already running this and have a crate (namespace)

Yep! I've reserved the lambda-powertools crate and am working on a DX proposal at the moment.

ZackKanter

ZackKanter commented on Sep 13, 2022

@ZackKanter

Any chance of re-opening this ticket?

heitorlessa

heitorlessa commented on Sep 19, 2022

@heitorlessa
Contributor

@ZackKanter thanks for the nudge!

As of now, we don't have plans to create Lambda Powertools for Rust due to skill set (@nmoutschen left) and staffing (not planned in the foreseeable future for Rust) -- We'll happily update this issue if that changes it.

nabsource

nabsource commented on Mar 31, 2023

@nabsource

Not sure if anything has changed, but wanted to say this would be welcome

BMorinDrifter

BMorinDrifter commented on Jun 30, 2023

@BMorinDrifter

I'm doing some work to close the gap a bit, at least for metrics.

https://crates.io/crates/metrics_cloudwatch_embedded

Example

use lambda_runtime::{Error, LambdaEvent};
use metrics_cloudwatch_embedded::lambda::handler::run;
use serde::{Deserialize, Serialize};

#[derive(Deserialize)]
struct Request {}

#[derive(Serialize)]
struct Response {
}

async fn function_handler(event: LambdaEvent<Request>) -> Result<Response, Error> {
    metrics::increment_counter!("requests", "Method" => "Default");

    Ok(Response {})
}

#[tokio::main]
async fn main() -> Result<(), Error> {
    tracing_subscriber::fmt()
        .with_env_filter(tracing_subscriber::filter::EnvFilter::from_default_env())
        .with_target(false)
        .without_time()
        .compact()
        .init();

    let metrics = metrics_cloudwatch_embedded::Builder::new()
        .cloudwatch_namespace("MetricsExample")
        .with_dimension("Function", std::env::var("AWS_LAMBDA_FUNCTION_NAME").unwrap())
        .lambda_cold_start_metric("ColdStart")
        .with_lambda_request_id("RequestId")
        .init()
        .unwrap();

    run(metrics, function_handler).await
}

Output

START RequestId: 4bd2d365-3792-46c8-9b6c-6132f9630fbb Version: $LATEST
{"_aws":{"Timestamp":1687947426188,"CloudWatchMetrics":[{"Namespace":"MetricsTest","Dimensions":[["Function"]],"Metrics":[{"Name":"ColdStart","Unit":"Count"}]}]},"Function":"MetricsTest","RequestId":"4bd2d365-3792-46c8-9b6c-6132f9630fbb","ColdStart":1}
{"_aws":{"Timestamp":1687947426188,"CloudWatchMetrics":[{"Namespace":"MetricsTest","Dimensions":[["Function","Method"]],"Metrics":[{"Name":"requests"}]}]},"Function":"MetricsTest","Method":"Default","RequestId":"4bd2d365-3792-46c8-9b6c-6132f9630fbb","requests":1}
END RequestId: 4bd2d365-3792-46c8-9b6c-6132f9630fbb
REPORT RequestId: 4bd2d365-3792-46c8-9b6c-6132f9630fbb Duration: 1.28 ms Billed Duration: 22 ms Memory Size: 128 MB Max Memory Used: 14 MB Init Duration: 20.02 ms

Under the hood tower::Service is used to hook up decoration before the handler (or inner service) and to flush metrics after the handler.

philschmid

philschmid commented on Dec 11, 2023

@philschmid

Is there an update on this? @nmoutschen

nmoutschen

nmoutschen commented on Dec 11, 2023

@nmoutschen

Is there an update on this? @nmoutschen

I no longer work at AWS, so unfortunately, I do not know

heitorlessa

heitorlessa commented on Dec 11, 2023

@heitorlessa
Contributor
philschmid

philschmid commented on Dec 11, 2023

@philschmid

Too bad i was hoping after the rust sdk v1 release this might come too.

LordMoMA

LordMoMA commented on Dec 16, 2024

@LordMoMA

what about 2025, any Rust support?

added
need-customer-influenceWe need customer feedback and influence before we can move forward with this
and removed
triagePending triage
on Jul 17, 2025
changed the title [-]Add Rust support for AWS Lambda Powertools[/-] [+]Feature Request: add Rust support to Powertools for AWS[/+] on Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-customer-influenceWe need customer feedback and influence before we can move forward with thisproposedCommunity submited

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ZackKanter@heitorlessa@michaelbrewer@nabsource@dreamorosi

        Issue actions

          Feature Request: add Rust support to Powertools for AWS · Issue #37 · aws-powertools/powertools-lambda