amazon-web-services - 模板错误:Fn::GetAtt 实例引用未定义资源 EventHandlerLambdaFunction
问题描述
谁能帮我找出问题所在?
我在我的无服务器 yml 中导入了这个 cloudformation 资源。这是我的功能配置:
Resources:
eventHandler:
Type: AWS::Serverless::Function
Properties:
CodeUri: eventLambda/
Handler: dist/app.eventHandler
Runtime: nodejs12.x
FunctionName: eventHandler
这是我引用它的地方:
eventSourceRule:
Type: 'AWS::Events::Rule'
Properties:
Name: eventSourceRule
EventBusName: omnibus-${self:custom.stage}
EventPattern: |
{
"source": ["op.api"]
}
RetryPolicy:
MaximumRetryAttempts: 5
MaximumEventAgeInSeconds: 900
DeadLetterConfig:
Type: SQS
QueueLogicalId: EBRuleDLQ
Targets:
- Arn:
Fn::GetAtt:
- 'EventHandlerLambdaFunction'
- 'Arn'
Id: 'eventSourceRule'
请注意,我已经尝试过eventHandler
,EventHandler
但这些都不起作用。这就是我收到的错误:
The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource EventHandlerLambdaFunction
解决方案
我认为您必须添加 资源的逻辑名称。
替换EventHandlerLambdaFunction
为实际资源名称eventHandler
。
您没有使用您定义的 Lambda 资源的逻辑名称。
您可以尝试使用简单的 YAML 语法:
Targets:
- Arn: !GetAtt eventHandler.Arn
推荐阅读
- r - 如何在 R 中专门使用带有 mxnet 包的 AMD RX Radeon
- r - 用 lubridate 计算经过时间的集合累积
- javascript - 将按键模拟为 keydown 和 keyup
- php - 在 PHP 中使用套接字时 Apache 多线程的限制
- java - 如何将正文添加到具有标头的 SpringBoot RestTemplate Put 请求
- javascript - 保护 Api 数据 React 客户端身份验证
- mysql - dbeaver mysql 访问被拒绝
- android - 跟踪所有触摸事件
- python - 如何使用python读取文本文件中的特定行
- regex - 正则表达式排除部分文本