Created
November 17, 2016 21:06
-
-
Save juancabrera/51b03a6481818e68dce65aab2f699d5a to your computer and use it in GitHub Desktop.
Deploy a Node Lambda function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// deploy.js | |
// how to: http://code.juan.me/how-to-deploy-a-node-lambda-function/ | |
// | |
const AWS = require('aws-sdk') | |
const fs = require('fs') | |
AWS.config.update({region: 'us-east-1'}) | |
const lambda = new AWS.Lambda() | |
const lambdaFunctionName = 'yourFunctionName' | |
fs.readFile("./fn.zip", (err, data) => { | |
if (err) throw err | |
lambda.updateFunctionCode({ | |
FunctionName: lambdaFunctionName, | |
ZipFile: data, | |
Publish: true | |
}, err => { | |
if (err) { | |
console.log('ERROR: ', err) | |
} else { | |
console.log('uploaded!') | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment