AWS lambda update-function-code with jar package via AWS CLI

10,524

You're probably missing the "fileb://" part for the jar.

aws lambda update-function-code --function-name my-lambda-name --zip-file fileb://./target/my-lambda-jar.1.0-SNAPSHOT.jar
Share:
10,524

Related videos on Youtube

Vinod Singh
Author by

Vinod Singh

Updated on June 04, 2022

Comments

  • Vinod Singh
    Vinod Singh almost 2 years

    I'm trying to update my lambda function code with jar from my local machine via AWS CLI. The aws lambda has commands to update function code for zip file but not for jar. I can upload by using s3 bucket, but I need to update from local itself.

    I know following are the way to update from S3 bucket and for zip:

    1. aws lambda update-function-code --function-name --s3-bucket --s3-key
    2. aws lambda update-function-code --function-name --zip-file "fileb://"

    I want to ask is there similar command exist for uploading jar as well?

    • MaiKaY
      MaiKaY about 6 years
      No. Just zip it and call aws lambda update-function-code.
    • Vinod Singh
      Vinod Singh about 6 years
      Thank MaikaY, but then it doesn't identify the Handler class. If I change the extension from zip to jar then it works
    • MaiKaY
      MaiKaY about 6 years
      Did you check the documentation? Creating a .zip Deployment Package (Java)
    • Vinod Singh
      Vinod Singh about 6 years
      Yes I checked the document. But from starting we are using java jar. I can switch to zip. But I don't want. But then I guess AWS doesn't provide much option
  • Vinod Singh
    Vinod Singh about 6 years
    Hi, thanks for your comment, but if you read the question carefully, I'm asking about upload of jar package not zip file. I have gone through the documentation, I know how to upload zip but didn't find anything for jar
  • DJ Spiess
    DJ Spiess about 6 years
    The example I gave is for loading a jar. It just uses the zip parameter. If you look at the file extension, it’s a jar.
  • wawawa
    wawawa over 3 years
    Hi do we still need the 'fileb://' bit for parameter --s3-bucket