Reducing cross-AZ latency with the AWS Lambda metadata endpoint
Compute Blog
AWS Lambda now exposes Availability Zone metadata through a metadata endpoint, enabling functions to discover their AZ ID and route to same-AZ resources to reduce cross-AZ latency and data transfer costs.
- Lambda metadata endpoint provides AZ ID (e.g., use1-az1) via authenticated HTTP request to reduce cross-AZ latency
- Available at no additional cost across all commercial AWS Regions, compatible with SnapStart, provisioned concurrency, and VPC functions
- Retrieve AZ ID using Powertools for AWS Lambda (Python, TypeScript, Java, .NET) or call endpoint directly with environment variables
- Route same-AZ reads to ElastiCache, RDS, Aurora, MemoryDB, EKS, and ECS resources while maintaining fallback paths
- AZ IDs (use1-az1) provide cross-account consistency unlike AZ names (us-east-1a) which vary per account
- Cache metadata at initialization, not per invocation, and refresh after SnapStart restore when AZ may change
Functions can now optimize latency-sensitive workloads by preferring same-AZ endpoints and implementing AZ-aware resilience patterns like targeted fault injection.
The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.
Related articles
The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.