本文介绍了AWS Lambda:没有名为“ cfnresponse”的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经部署了一个包含以下内容的AWS Lambda:
I have deployed an AWS lambda which contains:
import json
import boto3
import cfnresponse
import urllib.request
from botocore.exceptions import ClientError
def lambda_handler(event, context):
...
cfnresponse.send(event, context, status, responseData, "CustomResourcePhysicalID")
我试图获取<$的值c $ c> cfnresponse 在我的cloudformations中:
I tried to get the values of the cfnresponse
in my cloudformations:
Resources:
API:
Type: Custom::API
Version: '1.0'
Properties:
ServiceToken: arn:aws:lambda:eu-west-1:1234567891011:function:getCountry
Outputs:
Status:
Value:
!GetAtt API.Data
现在cfn卡住了,我得到了错误:
Now th cfn is stuck and I got the error:
Unable to import module 'lambda_function': No module named 'cfnresponse'
我在做什么错?当我检查。
What am I doing wrong? It seems the way to do it when I check the docs.
推荐答案
Cfnresponse仅在lambda中可用默认使用python 2.7。可能您正在使用3.6。
Cfnresponse is just available in lambda by default with python 2.7. Probably you are using 3.6.
这篇关于AWS Lambda:没有名为“ cfnresponse”的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!