Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I update my AWS Lambda function from VSCode?

So I have an AWS Lambda function written in NodeJS, but I am tired of coding in the AWS Console or having to manually zip my code in my VSCode to manually upload it in he AWS Console.

I know that I can update my function with aws lambda update-function-code --function-name myFunction --zip-file "fileb://myZipFile". But how can I zip it and launch this command every time I save my work in VSCode ?

Also, I am on Windows.

like image 798
Alex Mougenet Avatar asked Mar 09 '26 14:03

Alex Mougenet


1 Answers

You can't do this without some additional work.

A few options are:

  • use the Run on Save VS Code extension and configure a custom command to run when a file is saved
  • create a SAM project and install the AWS Toolkit for VS Code extension to provide deployment assistance
  • create a package.json that includes a script for zip/deployment and use the NPM extension for VS Code to execute the deploy script
  • build a CI/CD solution: use VS Code to commit and push your code, then the pipeline takes over and deploys it
  • use a shell script, or a Makefile with a target, that zips and deploys and then simply execute it, manually or otherwise, in the VS Code in-built terminal
like image 101
jarmod Avatar answered Mar 12 '26 07:03

jarmod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!