skillfed

crhelper

crhelper simplifies authoring CloudFormation Custom Resources

crhelper v2.0.12 482.8K downloads/30d#6,420 on PyPI384
Permissive license Apache2 DORMANT released

What it is and what it does

crhelper is a decorator-based library that wraps CloudFormation custom resource handlers to eliminate boilerplate and ensure robust error handling. It guarantees CloudFormation receives a response even when exceptions occur, catches Lambda timeouts, and provides structured JSON logging with request and stack IDs for tracing. The library supports long-running operations via polling, which re-invokes the Lambda function every 2 minutes until completion, bypassing the 15-minute Lambda timeout limit.

You use it by decorating handler functions for create, update, and delete lifecycle events, then calling the helper instance in your main handler. It manages response formatting, error propagation to CloudFormation stack events, and optional CloudWatch Events scheduling for polling workflows. Static typing is supported for mypy compatibility.

Use it for:

  • Create custom CloudFormation resources that provision third-party APIs or non-AWS services without writing response boilerplate.
  • Implement long-running provisioning tasks that exceed Lambda's 15-minute timeout using the polling decorator pattern.
  • Ensure CloudFormation stacks fail gracefully with meaningful error messages when custom resource handlers encounter exceptions.
  • Trace CloudFormation events through Lambda logs using structured JSON output with stack and request IDs.
  • Deploy infrastructure-as-code patterns that require custom logic beyond CloudFormation's native resource types.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Simplifies writing CloudFormation custom resources by handling responses, exception trapping, timeouts, and structured logging for AWS Lambda functions.

Yes, if you are writing CloudFormation custom resources in Lambda. The library eliminates error-handling boilerplate and ensures CloudFormation receives responses reliably. However, note that maintenance is dormant (654 days since last release); verify compatibility with your Python version and current boto3/CloudFormation APIs before adopting in new projects, and monitor for any security updates.

Install

crhelper on PyPI

pip

pip install crhelper

uv

uv add crhelper

poetry

poetry add crhelper

Installing crhelper

Before you install

Low install friction with no runtime dependencies. Maintenance is dormant—last release was 654 days ago, though the repository remains active with 384 stars and no recent commits.

License in practice

Licensed under Apache 2.0 (permissive), allowing use in commercial and private projects with minimal restrictions.

Quickstart

pip install crhelper

from crhelper import CfnResource
helper = CfnResource()

@helper.create
def create(event, context):
    helper.Data.update({"key": "value"})
    return "ResourceId"

def handler(event, context):
    helper(event, context)

Intended for AWS Lambda functions invoked by CloudFormation; requires appropriate IAM permissions if polling is enabled (lambda:AddPermission, events:PutRule, etc.).

Verify before relying

  • Whether the package works with Python versions beyond 3.6 and 3.7 (classifiers list only those two, but requires_python is unspecified).
  • Current compatibility with recent boto3 versions and CloudFormation API changes since the last release 654 days ago.

Package facts

License Apache2 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 654 days since the last release
Last repo commit
First released
Downloads 482,836/month — #6,420 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: crhelper-2.0.12-py3-none-any.whl

License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7

Tags

cloudformation custom resource lambdacfn custom resource helperlambda cloudformation integrationcustom resource response handlercloudformation lambda decoratorcfn resource lifecycle managementlambda timeout polling cloudformation
cloudformationaws-lambdainfrastructure-as-code

More Application Frameworks packages