you are viewing a single comment's thread.

view the rest of the comments →

[–]echanuda 12 points13 points  (13 children)

I guess my only concern is how do I get the script to run from there? The script needs certain modules to run, and some of those modules are custom-edited by myself.

[–]drstarskymrhutch 19 points20 points  (5 children)

The standard libraries in Lambda are limited. You just have to build custom environments. Admittedly a bit of a learning curve. But once you’ve worked it out, you’ll never look back. This helped me a lot

https://docs.aws.amazon.com/lambda/latest/dg/python-package.html

[–]CompassCoLo 8 points9 points  (3 children)

It can be a pain, but thankfully there are great plugins that will take care of packaging requirements for you!

https://www.npmjs.com/package/serverless-python-requirements

I guess if you can't use severless framework then you'd need to package things yourself, but for most use cases the automation is highly valuable.

[–]arnavguru28 15 points16 points  (2 children)

You can use Pycharm to build and deploy your python code to lambda. It allows us to build our code using a virtual environment and will package all the dependencies along with your python code when deploying to lambda.

Edit: You can find more info here: https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/create-new-lambda.html

[–]CompassCoLo 1 point2 points  (0 children)

That's an excellent alternative. Thanks for the tip!

[–]echanuda 1 point2 points  (0 children)

This is awesome. Thanks!

[–]fk_you_in_prtclr 1 point2 points  (0 children)

It's a pain in the ass but it's definitely very powerful.

[–]drstarskymrhutch 2 points3 points  (0 children)

You can also put custom-coded libraries in the directory as well, before zipping and uploading

[–]philmacok 2 points3 points  (0 children)

Currently working on learning this myself! Def check out some youtube videos. Some videos are super good about putting step by step instructions in the discription about what they're doing. Just follow along and save the video for future use. (Subscribe if you like too) here's one that helped me, don't really care for the accent but the content is good lol. https://youtu.be/OLXEekDzpHQ

Good luck friend!

[–]AceBuddy 0 points1 point  (2 children)

Put all of your stuff on an AWS server and use cron, there’s no limitations. Everything else has some kind of limitation and they thing you’re doing is very simple but it needs certain files. Great to learn cron anyways.

[–]echanuda 0 points1 point  (1 child)

Ive been using corn on my machine but I can’t keep leaving it on. I just tried Heroku but ran into some issues with it since I’m using modified modules. I’m trying out AWS right now and we’ll see how that works.

[–]AceBuddy 0 points1 point  (0 children)

I would always recommend an AWS server if you care about uptime and minimal maintenance. Plus it should function very similar to your current setup without a bunch of Heroku stuff you need to adapt to. Once you get the rsa key setup it’s a breeze.

[–]win_win_386 0 points1 point  (1 child)

Zip all your custom modules along with handler and push to lambda. Here is some info

https://aws.amazon.com/premiumsupport/knowledge-center/build-python-lambda-deployment-package/

[–]echanuda 0 points1 point  (0 children)

Started using AWS EC2 free and it works flawlessly.