Cl-6ren">
gpt4 book ai didi

amazon-web-services - 云信息 "update your Lambda function code so that CloudFormation can attach the updated version"

转载 作者:行者123 更新时间:2023-12-03 07:33:18 26 4
gpt4 key购买 nike

我正在从此 blog post 部署 CloudFormation 模板。我必须将 Lambda 函数从 python 3.6 更新到 3.9 才能使其正常工作。但是现在我收到以下错误消息:

> CloudFormation did not receive a response from your Custom Resource.
> Please check your logs for requestId
> [029f4ea5-cd25-4593-b1ee-d805dd30463f]. If you are using the Python
> cfn-response module, you may need to update your Lambda function code
> so that CloudFormation can attach the updated version.

下面是相关的 lambda 代码 - 更新 Lambda 函数“以便 CloudFormation 可以附加更新的版本”意味着什么?

    import util.cfnresponse
import boto3
import uuid

client = boto3.client('s3')

cfnresponse = util.cfnresponse

def lambda_handler(event, context):
response_data = {}
try:
if event["RequestType"] == "Create":
bucket_name = uuid.uuid4().hex+'-connect'
# response = client.create_bucket(
# Bucket=bucket_name,
# )
response_data["BucketName"] = bucket_name
cfnresponse.send(event, context, cfnresponse.SUCCESS, response_data)

cfnresponse.send(event, context, cfnresponse.SUCCESS, response_data)
except Exception as e:
print(e)
cfnresponse.send(event, context, cfnresponse.FAILED, response_data)

据我所知,响应格式遵循当前版本的 response module API

最佳答案

cfnrespone 库已更改并更新。旧版本的库使用请求库。这个 CF 已经有 4 年多了,所以它可能因此而无法工作。您可以在此处阅读自述文件最后几行的更新: https://github.com/gene1wood/cfnresponse

关于amazon-web-services - 云信息 "update your Lambda function code so that CloudFormation can attach the updated version",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74431851/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com