lambda-helper

0.1.8 • Public • Published

lambda-helper

A helper to create new AWS LAMBDA FUNCTION && add AWS API GATEWAY trigger to it && update code

Install

npm i --save lambda-helper

API

lambdaHelper.create(opts)

@param {object} opts

@param {string} opts.funcName

@param {string} [opts.funcDesp='no description']

@param {string} [opts.iamRole='arn:aws:iam::004629844575:role/lambda-gateway-execution-role']

@param {string} [opts.region='ap-southeast-1']

@param {string} [opts.runtime='nodejs6.10']

@param {number} [opts.timeout=60]

@param {number} [opts.memorySize=3008]

@param {[string]} [opts.enviroment=['NODE_ENV=production']] ex: ['KeyName1=string', 'KeyName2=string']

@param {string} [opts.deployStageName='prod']

@returns {promise} Promise object represents the api invication url

lambdaHelper.updateCode(opts)

@param {string} opts.funcName

@param {string} opts.codeDir

@param {string} [opts.codeS3Bucket='nitebell-lambda']

@returns {promise}

Usage

const {
    create,
    updateCode 
= require('./index');
 
const funcName = 'YOUR_LAMBDA_FUNCTION_NAME';
 
create({
    funcName
})
.then(apiInvocationUrl => {
    console.log(`Lambda Function ${funcName} && API GATEWAY Trigger 已建立: ${apiInvocationUrl}`);
    console.log('Updating code...');
    return updateCode({
        funcName,
        codeDir: `${__dirname}/lambda`
    })
    .then(() => console.log('完成 :D'))
    .catch(console.error);
})
.catch(console.error);

License

GPL-2.0

Readme

Keywords

none

Package Sidebar

Install

npm i lambda-helper

Weekly Downloads

12

Version

0.1.8

License

GPL-2.0

Unpacked Size

12.5 kB

Total Files

5

Last publish

Collaborators

  • xianyee.xing