gpt4 book ai didi

aws-lambda - 为 lambda 创建自定义资源触发器时出错

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

我通过 ts 文件创建了一个具有以下规范的 lambda:

        description: 'Lambda request handler to automate the DDL commands',
name: LAMBDA_NAME,
timeout: Duration.minutes(10),
memorySize: 512,
componentName: 'DdlLambda',
runtime: Runtime.JAVA_11,
handler: 'handler.ddllambda',
packageName: 'DDLManagementLambda-1.0',
deadLetterQueueEnabled: false,
tracing: Tracing.ACTIVE,
profiling: false,
logRetention: RetentionDays.FOUR_MONTHS

创建自定义资源

import {CustomResource} from "monocdk";

const customResource = new CustomResource(this, 'CustomResource', {
serviceToken: ddllambda.functionArn,
properties: {
version: "version_0"
}

但我收到错误

CloudFormation did not receive a response from your Custom Resource. 
Please check your logs for requestId [c634da01-9c4d-4f8e-a2fc-a28724aa8206].
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.

我无法找到给定 requestId 的日志。我在这里缺少什么?

最佳答案

您应该使用cfn-response.send在您的自定义资源中通知 CloudFormation


在控制台中查找日志:

对于日志,您可以从 lambda 页面中的控制台访问它们,点击监控,然后在 CloudWatch 中查看日志:

Lambda console access CloudWatch

进入CloudWatch后,点击搜索全部:

CloudWatch LogStream search all

然后在搜索框中将您的请求 ID 粘贴到双引号中:

Search Logs by Request ID


使用 aws-cli 查找日志:请参阅 this answer

关于aws-lambda - 为 lambda 创建自定义资源触发器时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73357120/

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