Mohit Tevatia
Mohit Tevatia

Reputation: 97

Automate Lambda deployments using S3 buckets zip bundled code

Details - I have a CircleCI job that makes a zip of my lambda code and uploads it to S3 (We just keep updating the version of same s3 object for e.g. code.zip we dont change name). Now i have CDK AWS code where i am defining the body of my lambda and making use of the s3 zip file using this url https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Code.html#static-fromwbrbucketbucket-key-objectversion.

Issue - Now i want something automated deployment that whenever there is new version of code.zip file gets uploaded to S3, my all lambdas using should be automatically updated with the latest code.

Please suggest !!!

Upvotes: 2

Views: 604

Answers (1)

Basant Kumar
Basant Kumar

Reputation: 66

I can think of 2 solution for this

  1. Have a step after you update the latest code in S3 to update your lambda function like below

aws lambda update-function-code
--function-name your_function_name
--s3-bucket --s3-key your_code.zip

  1. Create another lamda function and create S3 create object or whatever event suits for you and even you can filter by .zip

And in you lambda function which will be triggered by S3 upload you can again use same AWS cli command to update your lambda function

Upvotes: 1

Related Questions