No project description provided
Project description
AWS ALB Response Creator
The AWS announcement of Application Load Balancers supporting Lambda functions made my reInvent experience!
Purpose
In doing a PoC however, I found that the statusDescription
element was somewhat of an annoyance to code. This package provides a method to return the appropriate format of this field without copy/paste response data and allowing a strategy to implement this to swap out response formats for API Gateway or ALB as needed.
Installation
Run pip install alb-response
Usage
from alb_response import alb_response
def lambda_handler(event, context):
response_dict = process_the_event(event)
return alb_response(
http_status=200,
json=response_dict,
is_base64_encoded=False,
)
Architecture
- Setup an Application Load Balancer (ALB)
- Create a target group for the Lambda
- Assign appropriate permissions to your Lambda function
- Attach the target group to the ALB with a rule
Contributing
Contributions are welcome! Please open an issue or make a pull request.
If making a pull request, please run the tests and ensure that you maintain or increase code coverage.
Dependencies
To make this project more portable and keep environments organized, this project leverages pipenv
. To install deterministic dependencies, run pipenv sync
.
Run Tests
To run the tests, install the dependencies and run behave
.
To get code coverage as well, run coverage run --source='.' -m behave
followed by coverage report
.
Project details
Release history Release notifications | RSS feed
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 alb_response-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da44de1a419a21da8cfbe3bf6a89c22bd46d08eeafc6cc5bf79857d16e7e4d3f |
|
MD5 | c38f0221762b6e5f4f5f863df9a7db16 |
|
BLAKE2b-256 | 27de9fa9c198434eb9b346efd9f49e2f1cdb628f73683e1ad629a7f70b78825d |