6

Using pycharm on Windows.

I have created a zip file for upload to AWS Lambda the manual way: 1) Install the modules manually into a directory other than the default directory. 2) Create my .py code file 3) Zip the contents of the project folder 4) Upload that zip folder to Lambda

I am new to Pycharm and with a project I see that there are a whole bunch of files and folders that I do not understand.

I tried to zip the entire Pycharm project contents and upload - that did not work. It looks like I need to run some kind of setup that creates the proper folder structure and files that have the correct content.

Any help would be appreciated.

bgse
  • 8,237
  • 2
  • 37
  • 39
Eric Snyder
  • 1,816
  • 3
  • 22
  • 46
  • Well, it's better that you don't use PyCharm for that. – Noel Llevares Dec 09 '17 at 01:24
  • Follow the same manual way, but automate it using whatever language you know best. It can be a python script, a Windows powershell script, a Windows batch script, etc. – Noel Llevares Dec 09 '17 at 01:25
  • Is there a better IDE for python 3.6 that cooperates with Lambda? – Eric Snyder Dec 09 '17 at 17:13
  • 2
    There is Cloud9 (https://aws.amazon.com/de/cloud9/) from AWS, which should be integrated pretty well with AWS Lambda and all the other services. – Dunedan Dec 09 '17 at 17:24
  • It's better that you are not dependent on an IDE. – Noel Llevares Dec 09 '17 at 20:42
  • @Dunedan - Trying Cloud9 out. Still having issues. Even if I import an already working lambda function that was uploaded to AWS Lambda using a zipped directory structure the function still does not work. – Eric Snyder Dec 11 '17 at 01:08
  • 2
    Pycharm works like a charm. I use it to develop lambdas. I suggest you look into the [serverless framework](https://serverless.com). Combined with the [serverless-python-requirements](https://www.npmjs.com/package/serverless-python-requirements) plugin it should do what you need. – DrEigelb Dec 14 '17 at 08:57
  • @DrEigelb - those look good. I'll give them a test spin today! – Eric Snyder Dec 15 '17 at 15:26
  • @Dunedan - still having issues with cloud9. I AM liking it quite a bit. I had some issues installing packages in the right place. That is resolved see this post: https://stackoverflow.com/questions/47744280/python3-cloud9-lambda-making-imported-modules-available-to-lambda. Now I am having issues with mysql connector installing correctly - something I did just at home with pycharm. AWS support has been contacted, we'll see what they say. – Eric Snyder Dec 15 '17 at 15:28

2 Answers2

1

For all those still stuck with this, I have a few suggestions which could possibly resolve the issue altogether:

  • Use pip's -t option to specify the Application Directory

    Using Pip's -t option, one can specify the Application directory. It's better than using the pycharm's package installer, as we can specify the installation directory with this.

  • Zip the complete Application directory (Answer's your question)

    Go inside your Pycharm project directory -> select all -> Right Click -> send to compressed (zip). This may result in the inclusion of some unneeded directories (__pycache__, .idea), but would not affect the program execution. If needed, you may skip those two directories while creating the zip.

I believe you were zipping the project directory, rather than compressing the contents of the Project directory.

Amit
  • 109
  • 2
  • 2
  • 11
0

As I also answered here Jetbrains now offers the AWS Toolkit which allows local and remote development of Lambda functions.

Despite some lingering issues it works quite well. Still finding my way with it.

It includes packaging and deploying.

Toolkit page on Jetbrains website

Marakai
  • 1,163
  • 11
  • 26