1

我正在尝试使用kappa对 AWS Lambda 进行无缝部署。

我尝试修改S3 示例以上传 python 代码。我通过运行创建了 Lambda kappa ./config.yml create(在用我的aws 控制台配置文件替换配置文件之后)。lambda 已创建并显示在 AWS Function 控制面板中,如图所示:

在此处输入图像描述

我现在想转换这个示例来生成一个新的 lambda,但是是 Python 运行时。蟒蛇文件是:

examplefolder/hello_world.py

from __future__ import print_function

import json

print('Loading function')


def lambda_handler(event, context):
    #print("Received event: " + json.dumps(event, indent=2))
    print("value1 = " + event['key1'])
    print("value2 = " + event['key2'])
    print("value3 = " + event['key1'])
    return event['key2']  # Echo back the first key value
    #raise Exception('Something went wrong')

然后我修改了 lambda 相关部分config.yml

lambda:
  name: S3PythonSample
  zipfile_name: S3PythonSample.zip
  description: Testing S3 Lambda Python handler
  path: examplefolder/
  handler: hello_lambda.lambda_handler
  runtime: python

然后我再次运行kappa ./config.yml create以创建新的 Lambda,但出现此错误:

$ kappa ./config.yml create 
creating...
/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/connection.py:251: SecurityWarning: Certificate has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SecurityWarning
/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/connection.py:251: SecurityWarning: Certificate has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SecurityWarning
        Unable to upload zip file
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/kappa/function.py", line 162, in create
    MemorySize=self.memory_size)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 258, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 312, in _make_api_call
    raise ClientError(parsed_response, operation_name)
ClientError: An error occurred (ValidationException) when calling the CreateFunction operation: 1 validation error detected: Value 'python' at 'runtime' failed to satisfy constraint: Member must satisfy enum value set: [nodejs]
        Unable to add permission
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/kappa/function.py", line 141, in add_permissions
    response = self._lambda_svc.add_permission(**kwargs)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 258, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 312, in _make_api_call
    raise ClientError(parsed_response, operation_name)
4

1 回答 1

0

您收到的错误来自 botocore 的 2014-11-11 API 定义,这意味着您没有 2015-03-31 更新。

您应该能够pip install -U botocore更新并重试。

于 2016-07-04T12:56:29.877 回答