cfnresponse2


Namecfnresponse2 JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/ggiallo28/cfnresponse
SummarySend a response object to a custom resource by way of an Amazon S3 presigned URL
upload_time2023-09-13 22:04:16
maintainer
docs_urlNone
authorAmazon Web Services
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Streamline AWS CloudFormation Custom Resource Management with Python's `cfnresponse2`

Simplify the management of custom resources in AWS CloudFormation, especially within AWS Lambda environments, using the `cfnresponse2` Python package.

## Installation

You can effortlessly install the `cfnresponse2` package via pip:

```bash
pip install cfnresponse2
```

Alternatively, you have the option to download it directly or upload it to Amazon S3:

```python
import urllib3, sys, os

sys.path.append("/tmp")
raw_url = "https://raw.githubusercontent.com/ggiallo28/cfnresponse/master/cfnresponse/__init__.py"
with open("/tmp/cfnresponse.py", "wb") as f, urllib3.PoolManager() as http:
    f.write(http.request("GET", raw_url).data)

from cfnresponse import register_handler, lambda_handler


@register_handler("create", "update", "delete")
def myfun(event, context):
    return {}
```

## Practical Use Cases

`cfnresponse2` is designed with AWS Lambda functions in mind, serving as custom resource handlers in CloudFormation stacks. It simplifies CloudFormation operations such as creating, updating, and deleting custom resources. This empowers you to execute custom logic during stack operations.

For comprehensive examples showcasing effective usage of the `cfnresponse2` package, explore the [samples](https://github.com/ggiallo28/cfnresponse/tree/907255318ae6bea3729818036c20c323f5790952/samples) directory within the repository. These samples cover various scenarios of custom resource management within CloudFormation.

```python
from cfnresponse import register_handler, lambda_handler

@register_handler("create")
def custom_create(event, context):
    # Your custom logic for handling the 'create' action
    response_data = {"message": "Resource creation successful"}
    return response_data

@register_handler("update")
def custom_update(event, context):
    # Your custom logic for handling the 'update' action
    response_data = {"message": "Resource update successful"}
    return response_data

@register_handler("delete")
def custom_delete(event, context):
    # Your custom logic for handling the 'delete' action
    response_data = {"message": "Resource deletion successful"}
    return response_data
```

## Repository Structure

The project repository is organized as follows:

- `cfnresponse`: Houses the `__init__.py` file, serving as the core of the `cfnresponse2` module.
- `LICENSE`: Contains licensing information associated with the package.
- `README.md`: The document you are currently reading, offering essential instructions for usage.
- `samples`: Contains sample Lambda functions that provide practical demonstrations of `cfnresponse2` usage. The actual code resides in the repository, not within this README.
- `setup.py`: A configuration file for setting up the package.
- `tests`: Contains test cases tailored to evaluate the functionality of the `cfnresponse2` package.

## Important Note

`cfnresponse2` maintains compatibility with Amazon Web Services (AWS) `cfnresponse` module, readily available within Python AWS Lambda environments. You can seamlessly update your code with this package, ensuring a smooth transition without disruptions.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ggiallo28/cfnresponse",
    "name": "cfnresponse2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Amazon Web Services",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/d8/08/17cc185b9d5afbe06dce5eb9b80adefb0795041459623ad8ab2e8eaf3a75/cfnresponse2-1.0.7.tar.gz",
    "platform": null,
    "description": "# Streamline AWS CloudFormation Custom Resource Management with Python's `cfnresponse2`\n\nSimplify the management of custom resources in AWS CloudFormation, especially within AWS Lambda environments, using the `cfnresponse2` Python package.\n\n## Installation\n\nYou can effortlessly install the `cfnresponse2` package via pip:\n\n```bash\npip install cfnresponse2\n```\n\nAlternatively, you have the option to download it directly or upload it to Amazon S3:\n\n```python\nimport urllib3, sys, os\n\nsys.path.append(\"/tmp\")\nraw_url = \"https://raw.githubusercontent.com/ggiallo28/cfnresponse/master/cfnresponse/__init__.py\"\nwith open(\"/tmp/cfnresponse.py\", \"wb\") as f, urllib3.PoolManager() as http:\n    f.write(http.request(\"GET\", raw_url).data)\n\nfrom cfnresponse import register_handler, lambda_handler\n\n\n@register_handler(\"create\", \"update\", \"delete\")\ndef myfun(event, context):\n    return {}\n```\n\n## Practical Use Cases\n\n`cfnresponse2` is designed with AWS Lambda functions in mind, serving as custom resource handlers in CloudFormation stacks. It simplifies CloudFormation operations such as creating, updating, and deleting custom resources. This empowers you to execute custom logic during stack operations.\n\nFor comprehensive examples showcasing effective usage of the `cfnresponse2` package, explore the [samples](https://github.com/ggiallo28/cfnresponse/tree/907255318ae6bea3729818036c20c323f5790952/samples) directory within the repository. These samples cover various scenarios of custom resource management within CloudFormation.\n\n```python\nfrom cfnresponse import register_handler, lambda_handler\n\n@register_handler(\"create\")\ndef custom_create(event, context):\n    # Your custom logic for handling the 'create' action\n    response_data = {\"message\": \"Resource creation successful\"}\n    return response_data\n\n@register_handler(\"update\")\ndef custom_update(event, context):\n    # Your custom logic for handling the 'update' action\n    response_data = {\"message\": \"Resource update successful\"}\n    return response_data\n\n@register_handler(\"delete\")\ndef custom_delete(event, context):\n    # Your custom logic for handling the 'delete' action\n    response_data = {\"message\": \"Resource deletion successful\"}\n    return response_data\n```\n\n## Repository Structure\n\nThe project repository is organized as follows:\n\n- `cfnresponse`: Houses the `__init__.py` file, serving as the core of the `cfnresponse2` module.\n- `LICENSE`: Contains licensing information associated with the package.\n- `README.md`: The document you are currently reading, offering essential instructions for usage.\n- `samples`: Contains sample Lambda functions that provide practical demonstrations of `cfnresponse2` usage. The actual code resides in the repository, not within this README.\n- `setup.py`: A configuration file for setting up the package.\n- `tests`: Contains test cases tailored to evaluate the functionality of the `cfnresponse2` package.\n\n## Important Note\n\n`cfnresponse2` maintains compatibility with Amazon Web Services (AWS) `cfnresponse` module, readily available within Python AWS Lambda environments. You can seamlessly update your code with this package, ensuring a smooth transition without disruptions.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Send a response object to a custom resource by way of an Amazon S3 presigned URL",
    "version": "1.0.7",
    "project_urls": {
        "Homepage": "https://github.com/ggiallo28/cfnresponse"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c4a877a6c43aa6a04d47a42e3bfd5a561ff6de46d23e80d6e6199eac27ea9a1",
                "md5": "27c7fce86435b5386f1c8285cc61a11b",
                "sha256": "9ae69e51c71a62d450d84f88f335c50e047fecfd25c9c61f6e72eb36a1f9653c"
            },
            "downloads": -1,
            "filename": "cfnresponse2-1.0.7-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "27c7fce86435b5386f1c8285cc61a11b",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 8135,
            "upload_time": "2023-09-13T22:04:15",
            "upload_time_iso_8601": "2023-09-13T22:04:15.494819Z",
            "url": "https://files.pythonhosted.org/packages/9c/4a/877a6c43aa6a04d47a42e3bfd5a561ff6de46d23e80d6e6199eac27ea9a1/cfnresponse2-1.0.7-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d80817cc185b9d5afbe06dce5eb9b80adefb0795041459623ad8ab2e8eaf3a75",
                "md5": "67cf6cc9f2bb9d723da7be4363d7e080",
                "sha256": "8b83bf241fe307eb9445e6460fa97532d90b3620df708d9ecd0d28160fd4e7df"
            },
            "downloads": -1,
            "filename": "cfnresponse2-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "67cf6cc9f2bb9d723da7be4363d7e080",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8411,
            "upload_time": "2023-09-13T22:04:16",
            "upload_time_iso_8601": "2023-09-13T22:04:16.956130Z",
            "url": "https://files.pythonhosted.org/packages/d8/08/17cc185b9d5afbe06dce5eb9b80adefb0795041459623ad8ab2e8eaf3a75/cfnresponse2-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-13 22:04:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ggiallo28",
    "github_project": "cfnresponse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cfnresponse2"
}
        
Elapsed time: 0.37880s