Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Using the Lambda context object to retrieve Rust function information

Focus mode
Using the Lambda context object to retrieve Rust function information - AWS Lambda
Note

The Rust runtime client is an experimental package. It is subject to change and intended only for evaluation purposes.

When Lambda runs your function, it adds a context object to the LambdaEvent that the handler receives. This object provides properties with information about the invocation, function, and execution environment.

Context properties
  • request_id: The AWS request ID generated by the Lambda service.

  • deadline: The execution deadline for the current invocation in milliseconds.

  • invoked_function_arn: The Amazon Resource Name (ARN) of the Lambda function being invoked.

  • xray_trace_id: The AWS X-Ray trace ID for the current invocation.

  • client_content: The client context object sent by the AWS mobile SDK. This field is empty unless the function is invoked using an AWS mobile SDK.

  • identity: The Amazon Cognito identity that invoked the function. This field is empty unless the invocation request to the Lambda APIs was made using AWS credentials issued by Amazon Cognito identity pools.

  • env_config: The Lambda function configuration from the local environment variables. This property includes information such as the function name, memory allocation, version, and log streams.

Accessing invoke context information

Lambda functions have access to metadata about their environment and the invocation request. The LambaEvent object that your function handler receives includes the context metadata:

use lambda_runtime::{service_fn, LambdaEvent, Error}; use serde_json::{json, Value}; async fn handler(event: LambdaEvent<Value>) -> Result<Value, Error> { let invoked_function_arn = event.context.invoked_function_arn; Ok(json!({ "message": format!("Hello, this is function {invoked_function_arn}!") })) } #[tokio::main] async fn main() -> Result<(), Error> { lambda_runtime::run(service_fn(handler)).await }

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.