I need to somehow automate my Nodejs code deployment to Lambda. After looking at many alternatives (Serveless and others) and after talking to my team mates, we decided to use the Codeship for that. They already use it to connect to the Github, do the build there (npm i in my case). What we don't understand it, how to proceed after that step.
Upload it to S3, and somehow have Lambda pick it up? Or some other way of doing it?
Any insight is appreciated.
EDIT:
I was able to create Nodejs deployment to Lambda using Codeship fairly easy. I have followed these instructions. This is what I have under custom script:
pip install awscli
zip -r index.zip .
echo Zipping Done
aws lambda update-function-code --function-name "test_event_crm" --zip-
file fileb://index.zip
echo update function is done
aws lambda get-function --function-name "test_event_crm"
echo lambda get function is done
aws lambda invoke --function-name test_event_crm --payload "$(cat
data.json)” lambda_output.txt
echo **I dont end up here**
cat lambda_output.txt
echo **I also dont end up here**
The issue I face is the fact the code ends up from Github properly in the Lambda, but for some reason Build process never finishes. It just sits there, until it ends on its own (hours later). If you take a look at the echo command in the script, please notice that two last echo's are never executed. Build process keeps running.
What should I do to improve the script?
It seems that I need to send end command or something similar.
EDIT 2: I overlooked the script. There is an invoke function there, which I think I do not need. I have reworked the script, and it works now as expected. However, I am not sure is this the correct way of doing it. New script:
pip install awscli
zip -r index.zip .
echo Zipping Done
aws lambda update-function-code --function-name "test_event_crm" --zip-
file fileb://index.zip
echo update function is done
aws lambda get-function --function-name "test_event_crm"
echo Get function is done
echo Deploy is done
Do I need aws lambda get-function ???