in serverless, have following folder structure
/component_a/function_1/function_1.js (get) /component_a/function_2/function_2.js (get)
what best way function_1 call function_2 using serverless framework?
do not invoke function_2 function_1.
write 2 functions able complete respective tasks independently.
in order control flow of execution, should use aws step functions, lets co-ordinate between various lambda functions.
if want persist information, use storage service (like s3 or dynamodb) store information function_2 can use. let step functions direct traffic. check if service exists in region deploying functions.
here quick guide on aws step functions:
http://docs.aws.amazon.com/step-functions/latest/dg/welcome.html