Zappa

Table of Contents

Settings

exclude

Default excludes:

ZIP_EXCLUDES = [
    '*.exe', '*.DS_Store', '*.Python', '*.git', '.git/*', '*.zip', '*.tar.gz',
    '*.hg', '*.egg-info', 'pip', 'docutils*', 'setuputils*', '__pycache__/*'
]

This feature is implemented with shutil.ignorepatterns. This only checks the name, not the fullpath. So if you want to exclude __pycache__/*, you have to specify it like __pycache__. There is no way to exclude relative paths to the project currently.

Actually, even ZIP_EXCLUDES has improper patterns!

Topics

Packaging by Zappa

It seems that Zappa packages all files in the current working directory. So, it doesn't need to pip install . to include the project code.

slim_handler

When the slim handler is called on a cold start, it downloads the large project zip from S3 and unzips it in Lambda’s shared /tmp space. All subsequent calls to that warm Lambda share the /tmp space and have access to the project files; so it is possible for the file to only download once if the Lambda stays warm.

How-to

Configure HTTPS using AWS Certificate Manager

Because CloudFront requires ACM in us-east-1, Zappa is also under this restriction. So, make sure to use the proper region when registering ACM.

"dev": {
  "certificate_arn": "arn:aws:acm:us-east-1:1234:certificate/abcd",
  "domain": "dev.galpi.io",
}

I'm not sure whether it is safe to publish aws arn in a public git repository.

$ zappa certify