tessl install tessl/pypi-aws-lambda-powertools@3.19.0Comprehensive developer toolkit implementing serverless best practices for AWS Lambda functions in Python
Agent Success
Agent success rate when using this tile
89%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.22x
Baseline
Agent success rate without this tile
73%
Build a Lambda function that retrieves application configuration from multiple AWS parameter stores and provides a unified configuration object. The service should efficiently retrieve parameters with caching, handle different data types, and support both single and batch retrieval operations.
Multiple Parameter Sources: Support retrieving configuration from:
Single Parameter Retrieval: Implement a function that retrieves a single parameter by name from any of the supported sources.
Batch Parameter Retrieval: Implement a function that retrieves multiple parameters in a single operation. The function should accept a list of parameter names and return a dictionary mapping names to values.
Value Transformation: Support automatic JSON parsing for parameters that contain JSON-formatted strings. The transformation should be applied automatically based on parameter content or naming convention.
Caching: Enable caching for retrieved parameters to reduce API calls. Cache entries should have a reasonable time-to-live (TTL) to balance between freshness and performance.
Error Handling: Handle cases where parameters don't exist gracefully. The system should allow retrieving parameters with a default value if the parameter is not found.
Create the following functions in config_service.py:
get_parameter(name: str, source: str) -> str: Retrieves a single parameter from the specified sourceget_parameters_batch(names: list, source: str) -> dict: Retrieves multiple parameters from the specified sourceget_json_parameter(name: str, source: str) -> dict: Retrieves and automatically parses a JSON parameterget_parameter_with_default(name: str, source: str, default: str) -> str: Retrieves a parameter with fallback to default valueThe source parameter should accept values: "ssm", "secrets", "dynamodb"
Create test file test_config_service.py:
Input:
Expected behavior:
Input:
Expected behavior:
Input:
{"debug": true, "timeout": 30}Expected behavior:
Input:
Expected behavior:
Python toolkit for implementing serverless best practices in AWS Lambda.