Search code examples
aws-lambdapycharm

Organizing PyCharm projects for aws-lambda development


I'm developing a back-end for a mobile app and decided to use aws-lambda for it and write all the code in python. Thus I decided to use PyCharm as an IDE with AWS Toolkit plugin installed.

My problem is that it seems that for every lambda you need to create a separate PyCharm project. At first, it was not a problem, but now that I have ~20 lambdas in my backend it's becoming a nightmare since:

  1. To jump from developing one lambda to the other I need to reopen PyCharm project.
  2. To deploy a new version of lambda's code I need to manually choose which lambda's code I would like to update with current project's code - in other words, there's no way to link a *.py source code file to a particular lambda in AWS (or I'm not aware of it). And a couple of times I by mistake updated wrong lambdas.

That said I'm looking for a way to:

  1. Keep all the lambdas development in one PyCharm project, but keep different lambdas' source code in different *.py files.
  2. Somehow semi-manually link source code files to particular lambdas.

Solution

  • As I expected this was a stupid question. The answer to it is to use AWS SAM template to describe the lambdas, policies and other pieces of resources used in the app. Then the template file could be used to one-click deploy the app. And everything is automated. Magic. Please start with https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html