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

Question:

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
Asked By: codyc4321

||

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.

Answered By: jellycsc

In windows, you can open the folder navigation and right click a file to ‘compress’. The aws cli requires the file to be wrapped in quotes:

--zip-file "fileb://app.zip"

The app.zip is a file in the directory where the command is run, and the name just has to have the fileb prefix in front of it. The tutorial has an error where it doesn’t show this filename wrapped in quotes

Answered By: codyc4321

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!

Answered By: mim

How can I satisfy aws lambda create-function?

My Winturds 10 has 7-Zip, which seems to generate zip files incompatible with the create-function API. So I right-click on the file, then select "send to…" which will create an acceptable zip.
Then the create-function API was successful.

I found that the –zip-file argument wilwith double quotes, although I found that it works wi

Answered By: J Slick