AWS CLI创建lambda函数无法看到我在S3中的zip文件"没有这样的文件或目录"

时间:2017-08-31 15:13:53

标签: amazon-s3 lambda

我的第一次尝试是使用控制台,它工作正常。我有一个新的zip文件,在S3中成功上传到我的存储桶。我可以列出存储桶并查看这两个文件,但是当我尝试使用CLI创建Lambda函数时,它会返回"错误解析参数' - zip-file':无法加载paramfile" ; ..."没有这样的文件或目录:"

我希望从文档" fileb://path/to/file.zip"意味着要包含存储桶名称,但我不确定是否需要区域URL。我尝试使用带有和没有区域URL的结果相同的结果。

同样,如果我使用控制台创建Lambda,而不是CLI,我可以使用这些文件。我错过了什么?

[royce@localhost ~]$ aws s3 ls s3://uploads.lai
2017-08-18 10:27:48   60383836 userpermission-1.zip
2017-08-31 07:43:50   60389082 userpermission-4.zip
2017-08-18 14:15:43       1171 userpermission.db
[royce@localhost ~]$ aws lambda create-function --function-name awstest01 --zip-file "fileb://uploads.lai/userpermission-4.zip" --runtime java8 --role execution-role-arn --handler app.handler

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

1 个答案:

答案 0 :(得分:0)

如果您要从本地zip文件上传函数,则--zip-file标志。

如果您使用的是S3,那么命令应该是aws create function --code "S3Bucket=string,S3Key=string,S3ObjectVersion=string"

的命令

您可以在此查看参考: http://docs.aws.amazon.com/cli/latest/reference/lambda/create-function.html

相关问题