All Projects → danielwhatmuff → zappa

danielwhatmuff / zappa

Licence: other
Zappa Docker image based on Lambda compatible base

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to zappa

Zappa
Serverless Python
Stars: ✭ 11,859 (+14540.74%)
Mutual labels:  zappa
zappa-blog
A blog about Zappa, powered by Zappa. Zappa zappa zappa. Zappa.
Stars: ✭ 17 (-79.01%)
Mutual labels:  zappa
terraform-aws-zappa
Create a AWS VPC with associated resources for use with Zappa
Stars: ✭ 30 (-62.96%)
Mutual labels:  zappa
zappa-slack-inviter
A server-less Slack inviter
Stars: ✭ 32 (-60.49%)
Mutual labels:  zappa
xkcd-excuse-generator
Serverless image generator that uses XKCD comic as basis for _all_ excuses!
Stars: ✭ 63 (-22.22%)
Mutual labels:  zappa
zappa-ffmpeg
Run ffmpeg inside a lambda for serverless transformations.
Stars: ✭ 14 (-82.72%)
Mutual labels:  zappa

Zappa

Docker image for Zappa, based on the Lambda Docker Image

  • Requires Docker to be installed and running 🐋 Docker Install
  • Alias it to easily build and deploy Zappa projects, using Lambda compatible Libc libraries (No more ELF errors)
  • Ensure you have the AWS API env vars set for access key, secret key and default region (or use AWS credential/config files)
  • Source a pre-created virtual environment located at /var/venv or create your own persistent one within /var/task/ once in the container.

Build the image

$ git clone [email protected]:danielwhatmuff/zappa.git && cd zappa && docker build -t danielwhatmuff/zappa .

Build a customized image with extra build deps

# Add extra installs to the Dockerfile.update file, then run:
$ docker build --build-arg version=< zappa version > -t danielwhatmuff/zappa:< zappa version > -f Dockerfile.update .
# e.g.
$ docker build --build-arg version=0.38.1 -t danielwhatmuff/zappa:0.38.1 -f Dockerfile.update .

Or pull the image from Docker Hub

$ docker pull danielwhatmuff/zappa

Using exported AWS_DEFAULT_REGION, AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID env vars

$ alias zappashell='docker run -ti -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION -v $(pwd):/var/task  --rm danielwhatmuff/zappa bash'
$ alias >> ~/.bash_profile
$ cd yourzappaproject
$ zappashell
# Create a persistent virtualenv within the mounted volume and activate it
zappashell> virtualenv venv 
zappashell> source venv/bin/activate
# OR use the prebaked one...
zappashell> source /var/venv/bin/activate
# Install your requirements
zappashell> pip install -r requirements.txt
# Deploy the thing
zappashell> zappa deploy
# Update the thing
zappashell> zappa update

Using cross account IAM role from CLI config ~/.aws/credentials or ~/.aws/config

  • Example CLI config:-
[profile myprofile]
region = ap-southeast-2
role_arn = arn:aws:iam::ACCOUNTNUMBER:role/YourCrossAccountAssumableRole
  • Export the AWS_PROFILE to the profile name myprofile
$ export AWS_PROFILE=myprofile
  • Mount the code and config into the container
$ alias zappashell='docker run -ti -e AWS_PROFILE=$AWS_PROFILE -v $(pwd):/var/task -v ~/.aws/:/root/.aws  --rm danielwhatmuff/zappa bash'
zappashell> source yourvirtualenv/bin/activate
zappashell> pip install -r requirements.txt
zappashell> zappa deploy

Known Issues

  • On Mac - if you leave the Docker daemon running for too long, you will get time drift and zappa commands will fail with the below types of errors (so will AWS CLI commands) - to fix, just restart the daemon
Error: No Lambda ... detected in ... - have you deployed yet?
Warning! Couldn't get function ... in ... - have you deployed yet?
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].