I am trying to create an AWS Lambda function using the command
aws lambda create-function \
--function-name foo\
--runtime nodejs\
--role lambda_basic_execution \
--handler asdf --zip-file "fileb:://boom.zip"
I have a file called boom.zip available in the directory. But I cannot deploy using the above command.
The failure message I get is
--zip-file must be a file with the fileb:// prefix.
Does anyone have a working example to create a lambda function using the AWS CLI?
Creating AWS Lambda Function using AWS CLI--function-name − Specify the name of the function you want to invoke. --invocation-type(string) − by default the invokation-type is requestresponse. The values available to be used with invokation-type is RequestResponse, Event and DryRun.
Step 1: Create a Lambda Function Your Lambda function receives event data and returns a greeting message. Ensure that your Lambda function is under the same AWS account and AWS Region as your state machine. Open the Lambda console and choose Create function. On the Create function page, choose Author from scratch.
You can use the AWS SAM CLI sam build command with the --use-container to create your deployment package. This option builds a deployment package inside a Docker image that is compatible with the Lambda execution environment. For more information, see sam build in the AWS Serverless Application Model Developer Guide.
You have an extra colon ':' in the file spec.
$ aws lambda create-function --function-name foo --runtime nodejs --role lambda_basic_execution --handler asdf --zip-file "fileb:://boom.zip"
--zip-file must be a file with the fileb:// prefix.
Example usage: --zip-file fileb://path/to/file.zip
$ aws lambda create-function --function-name foo --runtime nodejs --role lambda_basic_execution --handler asdf --zip-file "fileb://boom.zip"
Error parsing parameter '--zip-file': Unable to load paramfile fileb://boom.zip: [Errno 2] No such file or directory: 'boom.zip'
On mac I had to use absolute path, but added to the prefix there are actually 3 slashes.
Prefix:
fileb://
Path
/Users/myuser/Apps/folder/zips/file.zip
Complete
fileb:///Users/myuser/Apps/folder/zips/file.zip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With