相关疑难解决方法(0)

AWS Lambda:没有名为“ cfnresponse”的模块

我已经部署了一个AWS Lambda,其中包含:

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")
Run Code Online (Sandbox Code Playgroud)

我试图cfnresponse在我的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
Run Code Online (Sandbox Code Playgroud)

现在,cfn卡住了,我得到了错误:

Unable to import module 'lambda_function': No module named 'cfnresponse' 
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?当我检查文档时,似乎是这样做的方法。

amazon-web-services aws-cloudformation aws-lambda

4
推荐指数
2
解决办法
2106
查看次数