Registry / aws / awslambdaric

awslambdaric

JSON →
library4.0.2pypypi✓ verified 23d ago

The AWS Lambda Runtime Interface Client (RIC) for Python is a lightweight library that implements the Lambda Runtime API. It enables you to use alternative base images or build custom runtimes for your Python Lambda functions, making them compatible with the Lambda service. It manages the interaction between the Lambda execution environment and your function code, handling invocation events and responses. The library is actively maintained by AWS and is currently at version 4.0.0.

pip install awslambdaric
INSTALL
IMPORT
SIG · AWSLAMBDARIC
A
awslambdaric
awspythonv4.0.2
Install
1.9s avg
Import
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 23.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.9s · import 0.000s · 20MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LambdaRuntimeException
from awslambdaric.lambda_runtime_exception import LambdaRuntimeException
from awslambdaric import LambdaRuntimeException

This quickstart demonstrates how to create a Python Lambda function using a custom container image with `awslambdaric`. You define your Lambda handler in `app.py` and then create a `Dockerfile` that installs `awslambdaric` and sets it as the container's entrypoint, with your function handler as the command. This allows the Lambda service to properly invoke your Python code within the custom runtime environment.

# app.py def handler(event, context): print(f"Received event: {event}") print(f"Context: {context.aws_request_id}") return {"statusCode": 200, "body": "Hello from Lambda!"} # Dockerfile FROM python:3.9-slim-buster # Set working directory WORKDIR /var/task # Copy function code COPY app.py . # Install awslambdaric and any other dependencies RUN pip install --no-cache-dir awslambdaric # Set the ENTRYPOINT to the AWS Lambda Runtime Interface Client ENTRYPOINT ["/usr/local/bin/python", "-m", "awslambdaric"] # Set the CMD to your Lambda handler CMD ["app.handler"]
aws-lambda-ric --version
Debug
Known issues
breakingVersion 3.0.0 of `awslambdaric` dropped support for Python runtimes older than 3.9. Functions using Python versions 3.8 or earlier will no longer work with `awslambdaric` v3.0.0 and newer.
fix
Upgrade your Python runtime to 3.9 or newer (e.g., Python 3.13 support was added in v3.0.0) and ensure your `awslambdaric` dependency is compatible.
affects: >=3.0.0
deprecatedAWS Lambda will deprecate Python 3.9 runtime. New functions using Python 3.9 will be blocked from creation after January 15, 2026, and existing functions cannot be updated with Python 3.9 after February 15, 2026.
fix
Plan to upgrade your Lambda functions to Python 3.10 or later versions. While `awslambdaric` itself supports Python 3.9+, the underlying Lambda service is deprecating the 3.9 runtime.
affects: All (affects Python 3.9 runtime environment)
gotchaWhen upgrading Python runtime versions for Lambda functions (e.g., from 3.7 to 3.9), ensure that external dependencies are correctly packaged at the root level of your deployment, not within a 'packages' folder, as the underlying Python runtime search path changed.
fix
Adjust your packaging script or `Dockerfile` to install dependencies directly into the root of your function's deployment directory (e.g., `/var/task`) or ensure they are properly accessible on the `PYTHONPATH`.
affects: All versions, specifically during Python runtime upgrades.
gotchaIncorrect configuration of `ENTRYPOINT` and `CMD` in Dockerfiles for custom runtimes is a common error. The `awslambdaric` module must be the `ENTRYPOINT`, and your function's handler path the `CMD`.
fix
Ensure your Dockerfile correctly sets `ENTRYPOINT ["/usr/local/bin/python", "-m", "awslambdaric"]` and `CMD ["your_module.your_handler_function"]`.
affects: All versions when using container images.
gotchaHistorical compatibility issues with the `simplejson` dependency (e.g., lack of Python 3.9 wheels for older `simplejson` versions) could lead to installation failures.
fix
`awslambdaric` versions 2.0.11 and newer (including 3.x and 4.x) have updated `simplejson` dependencies to be compatible with newer Python versions. Ensure you are using a recent `awslambdaric` version.
affects: <=2.0.11 (addressed in 2.0.11 and later)
gotchaVersion 3.0.0 introduced support for SnapStart runtime hooks. If you are leveraging AWS Lambda SnapStart, be aware of the new hooks and how they might affect your function's initialization lifecycle.
fix
Review the AWS Lambda documentation on SnapStart runtime hooks for Python to understand how to implement `after_restore` and `before_checkpoint` if your function uses SnapStart.
affects: >=3.0.0
Upgrade
Version history
4.0.2latest on PyPI · released Jul 30, 2026
Audit
Dependencies
simplejsonrequiredUsed for JSON serialization/deserialization; historically had compatibility issues with specific Python versions which have since been addressed.
Agent activity
50 hits · last 30 days
node
42
OpenAI (training)
1
Resources