Skip to content

Instantly share code, notes, and snippets.

@keegandonley
Last active April 12, 2018 17:31
Show Gist options
  • Save keegandonley/2da8b2e1c5a94d5da87fac3df88ed0fa to your computer and use it in GitHub Desktop.
Save keegandonley/2da8b2e1c5a94d5da87fac3df88ed0fa to your computer and use it in GitHub Desktop.
Auto-deploy to lambda
const { exec } = require('child_process');
const functions = [
'createSession',
'getGeneralResources',
'getFireResources',
'getMeaning',
'receiveMeaning',
'getHousingResources',
'receiveEmail',
'getResources',
'getMembers',
'updateSession',
];
functions.forEach((lambdaFunc) => {
const command = `cd ./scripts/lambda && zip ${lambdaFunc}.zip ${lambdaFunc}.js && aws lambda update-function-code --function-name ${lambdaFunc} --zip-file fileb://${lambdaFunc}.zip`;
const deploy = exec(command);
deploy.stdout.on('data', (data) => {
console.log(`deploy-cloud: ${data}`);
});
deploy.stderr.on('data', (data) => {
console.log(`deploy-cloud-err: ${data}`);
});
deploy.on('close', (code) => {
console.log(`deploy to cloud exited with code ${code}`);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment