简体   繁体   English

如何在本地部署AWS python Lambda项目?

[英]How to deploy AWS python Lambda project locally?

I got an AWS python Lambda function which contains few python files and also several dependencies. 我得到了一个AWS python Lambda函数,其中包含几个python文件以及几个依赖项。

The app is build using Chalice so by that the function will be mapped like any REST function. 该应用程序是使用Chalice构建的,因此该函数将像任何REST函数一样被映射。

Before the deployment in prod env, I want to test it locally, so I need to pack all this project (python files and dependencies), I tried to look over the web for the desired solution but I couldn't find it. 在prod env中进行部署之前,我想在本地进行测试,因此我需要打包所有该项目(python文件和依赖项),我试图在Web上查找所需的解决方案,但找不到。

I managed to figrue how to deploy one python file, but a whole project did not succeed. 我设法弄清楚如何部署一个python文件,但是整个项目都没有成功。

Take a look to the Atlassian's Localstack: https://github.com/atlassian/localstack 看看Atlassian的Localstack: https : //github.com/atlassian/localstack

It's a full copy of the AWS cloud stack, locally. 它是本地AWS云堆栈的完整副本。

I use Travis : I hooked it to my master branch in git, so that when I push on this branch, Travis tests my lambda, with a script that uses pytest , after having installed all its dependencies with pip install . 我使用Travis :我将其钩接到git的master分支中,以便在推入该分支时,Travis在使用pip install安装了其所有依赖项之后,使用使用pytest的脚本来测试我的lambda。 If all the tests passed, it then deploy the lambda in AWS in my prod-env. 如果所有测试均通过,它将在我的prod-env中将lambda部署在AWS中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM