如何使用AWS CLI创建AWS Lambda函数? [英] How can I create an AWS Lambda function using the AWS CLI?

查看:306
本文介绍了如何使用AWS CLI创建AWS Lambda函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用命令创建AWS Lambda函数

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"

我在目录中有一个名为boom.zip的文件.但是我无法使用上面的命令进行部署.

I have a file called boom.zip available in the directory. But I cannot deploy using the above command.

我收到的失败消息是

-zip文件必须是带有fileb://前缀的文件.

--zip-file must be a file with the fileb:// prefix.

有人有使用AWS CLI创建lambda函数的有效示例吗?

Does anyone have a working example to create a lambda function using the AWS CLI?

推荐答案

文件规范中还有一个冒号':'.

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'

这篇关于如何使用AWS CLI创建AWS Lambda函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆