Summary
In this release, we are pleased to announce a new utility for interacting with the Lambda Metadata Service, allowing you to easily retrieve information about the Lambda function, such as the Availability Zone ID.
A huge thanks to @acascell, @shaked-lokits, @maxrabin, and @amin-farjadi, for their contributions 🚀🌟
Lambda Metadata Service
You can now use get_lambda_metadata() function fetch metadata from the AWS Lambda Metadata endpoint, such as the Availability Zone ID. Results are cached for the sandbox lifetime and the utility automatically returns empty metadata outside of Lambda, so your code works seamlessly in local development and testing.
from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.metadata import LambdaMetadata, get_lambda_metadata
from aws_lambda_powertools.utilities.typing import LambdaContext
logger = Logger()
def lambda_handler(event: dict, context: LambdaContext) -> dict:
metadata: LambdaMetadata = get_lambda_metadata()
az_id = metadata.availability_zone_id # e.g., "use1-az1"
logger.append_keys(az_id=az_id)
logger.info("Processing request")
return {"az_id": az_id}Changes
- fix(ci): add ty check to parameters folder (#8035) by @leandrodamascena
- feat(buffer-handler): add buffering support for external loggers (#7994) by @acascell
📜 Documentation updates
- feat: add ldms feature (#8051) by @leandrodamascena
- feat(batch): add Kafka/MSK batch processing support (#7941) by @shaked-lokits
🐛 Bug and hot fixes
- fix(openapi): correct response validation for falsy objects (#7990) by @amin-farjadi
🔧 Maintenance
- fix(ci): add ty check to dataclasses utility (#8038) by @leandrodamascena
- fix(ci): add ty check to parser folder (#8037) by @leandrodamascena
- chore(deps): bump valkey-glide from 2.2.5 to 2.2.7 (#8030) by @dependabot[bot]
- chore(deps): bump aws-encryption-sdk from 4.0.3 to 4.0.4 (#8027) by @dependabot[bot]
- chore(deps-dev): bump types-python-dateutil from 2.9.0.20260124 to 2.9.0.20260305 (#8029) by @dependabot[bot]
- chore(deps-dev): bump ijson from 3.4.0.post0 to 3.5.0 (#8028) by @dependabot[bot]
- chore(deps-dev): bump aws-cdk from 2.1108.0 to 2.1110.0 in the aws-cdk group (#8023) by @dependabot[bot]
This release was made possible by the following contributors:
@acascell, @amin-farjadi, @dependabot[bot], @github-actions[bot], @leandrodamascena, @shaked-lokits, dependabot[bot] and github-actions[bot]