How to upload zip from the S3 bucket to lambda function using AWS CLI

0 votes
How to upload zip from the  S3 bucket or build target folder to lambda function using AWS CLI. I am using CLI in bamboo plan.

Something like below. In my bucket have multiple files. so only want to upload zip file. And every time file name get change. So don't want hard code the file name. That is why want to use *.zip

aws lambda update-function-code --function-name prod-prediction --zip-file fileb://./data/stage/target/*.zip
Apr 9, 2020 in Web Development by Abhishek
• 280 points
3,246 views

1 answer to this question.

0 votes

Hi@Abhishek,

You want to upload your zip file from s3 bucket to aws lambda function, for that you can use the bellow syntax.

To create one lambda function.

$ aws lambda create-function 
--function-name "awslambdausingcli" 
--runtime "pthon3.6" 
--role "arn:aws:iam::625297745038:role/lambdaapipolicy" 
--handler "awscli.handler" 
--timeout 5 
--memory-size 256 
--zip-file "fileb://awscli.zip"

To update that lambda function.

$ aws lambda
update-function-code
--function-name <value>
[--zip-file <value>]
[--s3-bucket <value>]
[--s3-key <value>]
[--s3-object-version <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Try with this once.

answered Apr 10, 2020 by MD
• 95,140 points
But as I already described that each time file name get change. So I don't want hard code the file name. That is why want to use *.zip. Will this solution work? I don't think so. Kindly suggest.
If you don't want to replace file name, then remove previous file and call the function with the same file name.

Related Questions In Web Development

+1 vote
1 answer

How to access the Angularjs scope of a particular html element from our console?

Hello, You should follow the below steps:-- 1.Compile and ...READ MORE

answered Jan 21, 2020 in Web Development by Niroj
• 82,680 points

edited Jan 21, 2020 by Niroj 160 views
0 votes
1 answer

How to Return JSON from PHP to JavaScript?

Hello @kartik, Php has an inbuilt JSON Serialising ...READ MORE

answered Jul 6, 2020 in Web Development by Niroj
• 82,680 points
668 views
0 votes
2 answers

Wix vs WordPress – How To Choose The Right One?

Hi, I know it's pretty late to ...READ MORE

answered Aug 14, 2020 in Web Development by markophillips
• 140 points

edited Aug 14, 2020 by markophillips 245 views
0 votes
1 answer

How to get value of HTML Checkbox from onclick/onchange events?

Hello @kartik, Use the click event, which won't fire until ...READ MORE

answered Oct 7, 2020 in Web Development by Niroj
• 82,680 points
582 views
0 votes
1 answer
0 votes
1 answer