1
votes

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?

2
No. Just zip it and call aws lambda update-function-code. - MaiKaY
Thank MaikaY, but then it doesn't identify the Handler class. If I change the extension from zip to jar then it works - Vinod Singh
Did you check the documentation? Creating a .zip Deployment Package (Java) - MaiKaY
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

2 Answers

18
votes

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
0
votes

run this command:

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