Skip to content

Simple wrapper for Zappa to allow injecting environment variables into a template.

Notifications You must be signed in to change notification settings

rhoai/rho-zappa

Repository files navigation

Rho Zappa

Simple wrapper for Zappa that allows you to use *.j2 templates for your zappa_settings.json file. This allows you to do things such as include environment variables in your Lambda deployment without tracking them in your repository.

Note: This is extremely limited at the moment, it only supports the ability to add environment variables. Future options will be added as necessary / PRs welcome.

Setup

  • Full instructions on using Zappa here: https://github.com/Miserlou/Zappa
  • Create a zappa_settings.j2 file in your repository in place of your zappa_settings.json file.
  • Add whatever logic you want in the jinja2 template (example below)
  • Run command through Rho Zappa instead of directly to Zappa. e.g. rho-zappa --env .env.atla-vista-dev01 --cmd update --dest dev instead of zappa update dev

Example Template

{
    "dev": {
        "project_name": "my-awesome-project",
        "app_function": "my_awesome_project.app.app",
        "profile_name": "my_awesome_zappa_user",
        "s3_bucket": "my_awesome_s3_bucket",
        "api_key_required": true,
        "environment_variables": {
        {% for env_tuple in env_tuples -%}
          "{{env_tuple[0]}}": "{{env_tuple[1]}}"{{ "," if not loop.last }}
        {% endfor %} }
    }
}

Testing

To run the tests you need to have pyenv running on your system and tox in your environment.

After pyenv is intalled, then install tox

$ pip install tox

Then install the different python versions in pyenv

$ pyenv install 2.7.8 3.3.6 3.4.4 3.5.1

Now, run the tests:

$ tox

About

Simple wrapper for Zappa to allow injecting environment variables into a template.

Resources

Stars

Watchers

Forks

Packages

No packages published