[英]How to describe AWS Lambda function test events in CloudFormation template?
I describe existing AWS Lambda function in CloudFormation template and I face with the next issue. 我在CloudFormation模板中描述了现有的AWS Lambda函数,我将面对下一期。 In our Lambda we configured few test events which helps us to verify some usecases (I mean functionality from the screenshot below). 在我们的Lambda中,我们配置了一些测试事件,这有助于我们验证一些用例(我的意思是下面的截图中的功能)。
But I don't see any abilities to add these test events to the CloudFormation template. 但我没有看到任何将这些测试事件添加到CloudFormation模板的能力。 AWS documentation don't help me with that. AWS文档对此没有帮助。 Is that possible at all or are there any workarounds how to export and import Lambda function test events? 这是可能的,还是有任何变通方法如何导出和导入Lambda函数测试事件?
Lambda test functionality is available only in the UI console, You can use Cloudformation Custom Resource to invoke a function from a cloudformation template. Lambda测试功能仅在UI控制台中可用,您可以使用Cloudformation Custom Resource从云信息模板调用功能。 Resource properties allow AWS CloudFormation to create a custom payload to send to the Lambda function. 资源属性允许AWS CloudFormation创建自定义有效负载以发送到Lambda函数。
Sample code: 示例代码:
Resources:
EnableLogs:
Type: Custom::EnableLogs
Version: '1.0'
Properties:
ServiceToken: arn:aws:lambda:us-east-1:acc:function:rds-EnableRDSLogs-1O6XLL6LWNR5Z
DBInstanceIdentifier: mydb
the event parameter provides the resource properties. event参数提供资源属性。 ex: 例如:
event['ResourceProperties']['DBInstanceIdentifier']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.