Send a response object to a custom resource by way of an Amazon S3 presigned URL
Project description
AWS CloudFormation Custom Resource Handling with Python's cfnresponse
Package
The cfnresponse
package is a Python module tailored for streamlining custom resource management in AWS CloudFormation, especially within AWS Lambda environments. This package empowers developers to create, update, and delete custom resources seamlessly using Lambda functions.
Practical Use
Designed primarily for AWS Lambda functions serving as custom resource handlers in CloudFormation stacks, the cfnresponse
package extends CloudFormation's capabilities by enabling the execution of custom logic during stack creation, updates, or deletions.
For detailed examples showcasing how to leverage the cfnresponse
package, you can explore the samples directory in this repository. Each sample demonstrates various scenarios of custom resource handling within CloudFormation.
Repository Structure
The project repository is structured as follows:
cfnresponse
: Houses the__init__.py
file, providing the corecfnresponse
module.LICENSE
: Contains licensing information pertinent to the package.README.md
: The very document you are reading, offering essential usage instructions.samples
: Comprises sample Lambda functions that exemplify practicalcfnresponse
usage (actual code is found in the repository, not within this README).setup.py
: Configuration file for setting up the package.tests
: Encompasses test cases tailored for evaluating thecfnresponse
package's functionality.
Important Note
This package maintains backward compatibility with Amazon Web Services (AWS) cfnresponse module, which is available within Python AWS Lambda environments. If you wish to compare the code in this package with the original, you can do so with the following commands:
if [ "$(curl -s https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/CloudFormation/MacrosExamples/StackMetrics/lambda/cfnresponse.py | sha256sum)" = "$(curl -s https://raw.githubusercontent.com/gene1wood/cfnresponse/master/cfnresponse/__init__.py | sha256sum)" ]; then
echo "GitHub version matches AWS version";
fi
if [ "$(curl -s https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/CloudFormation/MacrosExamples/StackMetrics/lambda/cfnresponse.py | sha256sum)" = "$(wget --quiet https://files.pythonhosted.org/packages/03/69/2d3fafdf434a0d8ef62a5c1fa09feda25b31fad4db20c54ed067054f9b95/cfnresponse-1.1.2-py2.py3-none-any.whl && unzip -p cfnresponse-1.1.2-py2.py3-none-any.whl cfnresponse/__init__.py | sha256sum && rm cfnresponse-1.1.2-py2.py3-none-any.whl)" ]; then
echo "PyPI version matches AWS version";
fi
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cfnresponse2-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e22fab0b334a2742d001d4a30aa6c0bb9c5821db7cc4bec4693f815470d3a2f |
|
MD5 | 5893c1c3eaf7c6a6580a94bbab67ad4e |
|
BLAKE2b-256 | 94797e5dc9d424ce48363910c34e10c49bc3ab1ef4b7a793c51fe6fa7ec5fac2 |