I have several AWS Lambda functions in Serverless, and found I was writing the same sendEmail function over and over. Just setting up the client and composing the SES response with a few minor tweaks. I decided it would be best to abstract this to a single function that is called by the others. My folder structure resembles:
Serverless
-----> Commons
-----------> sendEmail.py
-----> AlarmsManager
---------> Alarm1.py
---------> Alarm2.py
---------> serverless.yml
-----> BackupManager
---------> Backup1.py
---------> Backup2.py
---------> serverless.yml
My question is, how do I call this email function from other deployments? Is it as simple as including a fully-qualified path to it in the calling function's serverless.yml file (which already has the proper SES IAM permissions), or will this need its own serverless.yml file with a trigger instead of an event schedule? Can I even make use of it from other functions if it belongs to its own deployment? Obviously, I'd prefer the former, but I'm confused as to how it should all come together.