Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error parsing parameter '--zip-file': Unable to load paramfile fileb://app.zip: [Errno 2] No such file or directory: 'app.zip'

I am following tutorial to write to VPS database at https://docs.aws.amazon.com/lambda/latest/dg/services-rds-tutorial.html

I get down to "Create the Lambda function". I have a folder in home called aws_mysql_tutorial/app.py and also init.py which is the app.py the tutorial shows to run the db commands. I did not find a command line way to zip this file or folder, but I see the argument --zip-file fileb://app.zip and have no idea what to zip and where to put it...I do not know what 'fileb' path means.

How can I satisfy aws lambda create-function?

after making a 7zip file, I get the following error

$ aws lambda create-function --function-name CreateTableAddRecordsAndRead --runtime python3.8 --zip-file fileb://app.7z --handler app.handler --role arn:aws:iam:::role/lambda-vpc-role --vpc-config SubnetIds=subnet-,subnet-,SecurityGroupIds=sg-

--zip-file must be a zip file with the fileb:// prefix.
Example usage:  --zip-file fileb://path/to/file.zip
like image 647
codyc4321 Avatar asked Oct 15 '25 04:10

codyc4321


2 Answers

Looks like the step that creates a zip file is missing in the documentation. 7z is not supported here. You must create a .zip. You can use the following command to zip the lambda handler:

zip -r app.zip app.py

Then you should be able to execute the create-function successfully.

like image 78
jellycsc Avatar answered Oct 16 '25 18:10

jellycsc


Not sure why! but you need to have 3 slashes after fileb, like this:

aws lambda update-function-code --function-name my-function \
--zip-file fileb:///path/lambdaFunc.zip

I had to deal with this today, took me a while to figure it out! even the dodumentation has it wrong!

like image 44
mim Avatar answered Oct 16 '25 17:10

mim



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!