0

I am trying to share some classes code between my lambdas in a serverless project that has several lambdas. I don't want to use layers to share the code as i want to iterate quickly over the shared code. Also i do not want to package my shared code in pip modules.

Is there any way to achieve this ? It seems so easy, so i am astonished there is no obvious documented solution for that beside using layers.

My preferred structure would be:

  • lambda1
    • handly.py
  • lambda2
    • handle.py
  • common_code
    • shared.py
Hendrik Jander
  • 5,515
  • 3
  • 23
  • 31
  • As far as I know if you don't pack functions separately serverless zip whole project and deploys it to all lambda functions. – Jan Giacomelli Jul 12 '19 at 12:31
  • Why exactly do you want to avoid `pip`? You could package the entire project as one module and just use different entry points in different lambdas. – tripleee Jul 12 '19 at 12:38
  • @tripleee Thats what i do. But how could i define shared code and import it in my lambdas? pip is too slow for sharing code. – Hendrik Jander Jul 12 '19 at 14:13
  • "Slow" how? Rather sounds like your current deployment model is flawed. Maybe look into CI/CD automation. – tripleee Jul 12 '19 at 14:41
  • @tripleee slow in the sense of rapid iteration over the shared code. still i think i am missing something – Hendrik Jander Jul 12 '19 at 15:19

0 Answers0