CI/CD fbprophet on AWS Lambda using CircleCI
About a year ago I was trying to figure out how to get fbprophet forecasting work on a AWS Lambda and eventually got it working. Since then the need for serverless forecasting matured, and more people got interested in making the tech seamless, leading to some very helpful stuff, like an fbprophet assembler for AWS Lambda by Marc Metz. A natural evolution from just getting the package working is to make it part of your CI/CD process. I had a need to deploy my forecasting code frequently — was integrating a forecasting microservice into other apps — and manually generating and uploading zips was not an option. I’m gonna share how I solved it for CircleCI. Hope you’ll find it useful and reusable for other CI/CD solutions. The foundation for consistent deploys is this Docker image with fbprophet pre-installed into AWS Lambda Python 3.6 environment. It has full, unedited fbprophet, so that customization is possible on the CI/CD side. For example, you may or may not want to uninstall matplotlib from the Docker. Feel free to use he image at your discretion. Below is the Dockerfile for it (built off Marc Metz’s) and here’s the whole repo. Below is the CircleCI config.yml code I use. It leverages the path to the virtualenv set up in Docker to prepare fbprophet for deploy. Next time will share a bit more about how we use fbprohet at scale at Agnoris. Cheers!

