Tim-B / grunt-aws-lambda

A grunt plugin to assist in developing functions for AWS Lambda.
MIT License
247 stars 100 forks source link

Adding support for S3 function code updates. Updated mocks and README #95

Closed toshke closed 7 years ago

toshke commented 7 years ago

Support for uploading code via S3, rather than directly

toshke commented 7 years ago

Will check the tests in upcoming days, and comply with coding conventions.

piercus commented 7 years ago

@toshke what do you think of https://github.com/Tim-B/grunt-aws-lambda/pull/103 ?

Thanks for your help

toshke commented 7 years ago

@piercus i've already opened https://github.com/Tim-B/grunt-aws-lambda/pull/102, including mocks tests and code that passes linter with success. As for https://github.com/Tim-B/grunt-aws-lambda/pull/103 - looking at https://github.com/Tim-B/grunt-aws-lambda/pull/103/files, I can't find place where s3 upload actually takes place.

piercus commented 7 years ago

@toshke

I'm not sure s3 upload should be done on grunt-aws-lambda, i'm suggesting to use grunt-aws-s3 for the upload.

On my point of view, to keep things granular, lambda_deploy should just be able to :

With this we can connect with grunt-aws-s3

see my example in

grunt.initConfig({
    lambda_deploy: { 
        env: {
            arn: 'arn:aws:lambda:us-east-1:123456781234:function:my-function',
            s3_bucket: 'my-lambda-code-bucket',
            s3_key_prefix: 'folderName'
        }
    },
    lambda_package: {
        env: {
            options: {}
        }
    },
    aws_s3: { 
        env: {
            options: {
                bucket: 'my-lambda-code-bucket'
            },
            files: [
                {action: 'upload', expand: true, src: ['dist/**'], differential: true, dest: 'folderName'}
            ]
        }
    }
});
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-aws-lambda');    
grunt.registerTask('deploy', ['lambda_package', 'aws_s3', 'lambda_deploy']);