Guest User

Untitled

a guest
Apr 20th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. const { exec } = require('child_process');
  2.  
  3. const functions = [
  4. 'createSession',
  5. 'getGeneralResources',
  6. 'getFireResources',
  7. 'getMeaning',
  8. 'receiveMeaning',
  9. 'getHousingResources',
  10. 'receiveEmail',
  11. 'getResources',
  12. 'getMembers',
  13. 'updateSession',
  14. ];
  15.  
  16. functions.forEach((lambdaFunc) => {
  17. const command = `cd ./scripts/lambda && zip ${lambdaFunc}.zip ${lambdaFunc}.js && aws lambda update-function-code --function-name ${lambdaFunc} --zip-file fileb://${lambdaFunc}.zip`;
  18. const deploy = exec(command);
  19.  
  20. deploy.stdout.on('data', (data) => {
  21. console.log(`deploy-cloud: ${data}`);
  22. });
  23.  
  24. deploy.stderr.on('data', (data) => {
  25. console.log(`deploy-cloud-err: ${data}`);
  26. });
  27.  
  28. deploy.on('close', (code) => {
  29. console.log(`deploy to cloud exited with code ${code}`);
  30. });
  31.  
  32. });
Add Comment
Please, Sign In to add comment