https://github.com/jaymon/herd
Quickly and easily create AWS lambda python functions and make them available from a url
https://github.com/jaymon/herd
Last synced: 9 months ago
JSON representation
Quickly and easily create AWS lambda python functions and make them available from a url
- Host: GitHub
- URL: https://github.com/jaymon/herd
- Owner: Jaymon
- Created: 2019-11-13T02:13:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-01T01:41:43.000Z (about 6 years ago)
- Last Synced: 2025-08-15T19:51:03.899Z (10 months ago)
- Language: Python
- Size: 59.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Herd
Quickly and easily create [AWS lambda](https://aws.amazon.com/lambda/) python functions and make them available from a url.
## 1 Minute getting started
### Install herd
$ pip install herd
### Create a lambda file
Create a python file:
$ touch foo.py
and then edit `foo.py` to add a lambda function:
```python
# foo.py
import json
def handler(event, context):
"""This is the description of the lambda function that will show up in AWS console"""
return {
'statusCode': 200,
'body': json.dumps({'query_string': event["queryStringParameters"]}),
}
```
### Set your amazon environment
You should set a few environment variables:
```
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_DEFAULT_REGION="us-west-1"
```
### Upload your function using herd
$ herd function-add foo.py
Function foo available at url: https://XXXXXXXXXXX.execute-api.us-west-1.amazonaws.com/herd-lambda-api/foo
### Verify your function is available
$ curl "https://XXXXXXXXXXX.execute-api.us-west-1.amazonaws.com/herd-lambda-api/foo?foo=1&bar=2"
{"query_string": {"foo": "1", "bar": "2"}}
That's it!
### Environment variables
You can pass in environment variables that your lambda function would have access to by defining them on the command line:
$ herd function-add foo.py --ENV_NAME_1=value1 --ENV_NAME_2=value2
----------------------------------------------
Herd is still in an alpha state and as we start using it for some of our infrastructure I'm sure it will change here and there. We also have more functionality planned for it in the future.