From rust-lambda
Add HTTP event handling to a Rust Lambda function for use with API Gateway, Application Load Balancers, or Lambda Function URLs. Use when the user wants to expose their function over HTTP. Provides two approaches: typed API Gateway events or the unified lambda_http crate.
npx claudepluginhub lep511/claude-rust-lambda-plugin --plugin rust-lambdaThis skill uses the workspace's default tool permissions.
Add HTTP event processing to the Rust Lambda function.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Add HTTP event processing to the Rust Lambda function.
api-gateway, alb (Application Load Balancer), function-url, or any (unified)lambda_http abstractionUse aws_lambda_events with feature flags to minimize compilation time:
aws_lambda_events = { version = "0.8.3", default-features = false, features = ["apigw"] }
http = "1"
use aws_lambda_events::apigw::{ApiGatewayProxyRequest, ApiGatewayProxyResponse};
use http::HeaderMap;
use lambda_runtime::{service_fn, Error, LambdaEvent};
async fn handler(
_event: LambdaEvent<ApiGatewayProxyRequest>,
) -> Result<ApiGatewayProxyResponse, Error> {
let mut headers = HeaderMap::new();
headers.insert("content-type", "text/html".parse().unwrap());
let resp = ApiGatewayProxyResponse {
status_code: 200,
multi_value_headers: headers.clone(),
is_base64_encoded: false,
body: Some("Hello AWS Lambda HTTP request".into()),
headers,
};
Ok(resp)
}
#[tokio::main]
async fn main() -> Result<(), Error> {
lambda_runtime::run(service_fn(handler)).await
}
Available pre-defined event types in aws_lambda_events (use the corresponding feature flag):
apigw → ApiGatewayProxyRequest / ApiGatewayProxyResponsealb → AlbTargetGroupRequest / AlbTargetGroupResponsesqs → SqsEvents3 → S3Eventsns → SnsEventkinesis → KinesisEventSee the full list at https://crates.io/crates/aws_lambda_events
Works transparently with API Gateway, Application Load Balancers, and Lambda Function URLs without changing code. Uses native HTTP types.
Note: lambda_http uses lambda_runtime internally — do NOT import lambda_runtime separately.
lambda_http = "0.13.0"
use lambda_http::{service_fn, Error, IntoResponse, Request, RequestExt, Response};
async fn handler(event: Request) -> Result<impl IntoResponse, Error> {
let resp = Response::builder()
.status(200)
.header("content-type", "text/html")
.body("Hello AWS Lambda HTTP request")
.map_err(Box::new)?;
Ok(resp)
}
#[tokio::main]
async fn main() -> Result<(), Error> {
lambda_http::run(service_fn(handler)).await
}
async fn handler(event: Request) -> Result<impl IntoResponse, Error> {
// Query string parameters
let params = event.query_string_parameters();
let name = params.first("name").unwrap_or("world");
// Request body
let body = std::str::from_utf8(event.body()).unwrap_or("");
let resp = Response::builder()
.status(200)
.header("content-type", "application/json")
.body(format!(r#"{{"message": "Hello, {}!"}}"#, name))
.map_err(Box::new)?;
Ok(resp)
}
Remind the user:
--runtime provided.al2023 when deployingrust.handlercargo lambda invoke --remote \
--data-file ./test-events/apigw-event.json \
<function-name>