Amazon cloudformation 由于未找到处理程序错误,无法部署aws sam堆栈
使用Amazon cloudformation 由于未找到处理程序错误,无法部署aws sam堆栈,amazon-cloudformation,aws-sam,Amazon Cloudformation,Aws Sam,使用sam在嵌套目录中部署带有处理程序的lambda时遇到问题 我执行以下步骤: 包装: sam包--template template.yaml--输出模板文件packated.yaml--s3 bucket 创建我在下一步中使用的packaged.yaml 部署: aws cloudformation部署--模板文件/Users/localuser/Do/learn sam/dynamo stream lambda/package.yaml--堆栈名barkingstack 错误 Faile
sam
在嵌套目录中部署带有处理程序的lambda时遇到问题
我执行以下步骤:
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [PublishNewBark] is invalid. Missing required property 'Handler'.
Cloudformation/SAM模板
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Globals:
Function:
Runtime: nodejs8.10
Timeout: 300
Resources:
PublishNewBark:
Type: AWS::Serverless::Function
FunctionName: publishNewBark
CodeUri: .
Handler: src/index.handler
Role: "<ROLE_ARN>"
Description: Reads from the DynamoDB Stream and publishes to an SNS topic
Events:
- ReceiveBark:
Type: DynamoDB
Stream: !GetAtt BarkTable.StreamArn
StartingPosition: TRIM_HORIZON
BatchSize: 1
BarkTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: BarkTable
KeySchema:
- KeyType: HASH
AttributeName: id
AttributeDefinitions:
- AttributeName: id
AttributeType: S
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
ProvisionedThroughput:
WriteCapacityUnits: 5
ReadCapacityUnits: 5
WooferTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: wooferTopic
TopicName: wooferTopic
Subscription:
- Endpoint: <my_email>
Protocol: email
我相信您必须将除资源类型之外的所有内容都放在“属性”下 您的函数声明应该是:
PublishNewBark:
Type: AWS::Serverless::Function
Properties:
FunctionName: publishNewBark
CodeUri: .
Handler: src/index.handler
Role: "<ROLE_ARN>"
Description: Reads from the DynamoDB Stream and publishes to an SNS topic
Events:
- ReceiveBark:
Type: DynamoDB
Stream: !GetAtt BarkTable.StreamArn
StartingPosition: TRIM_HORIZON
BatchSize: 1
PublishNewBark:
类型:AWS::Serverless::Function
特性:
功能名称:publishNewBark
代码URI:。
处理程序:src/index.Handler
角色:“”
描述:读取DynamoDB流并发布到SNS主题
活动:
-接受者:
类型:发电机B
小溪:!GetAtt BarkTable.StreamArn
启动位置:微调地平线
批量大小:1
我认为您必须将除资源类型之外的所有内容都放在“属性”下
您的函数声明应该是:
PublishNewBark:
Type: AWS::Serverless::Function
Properties:
FunctionName: publishNewBark
CodeUri: .
Handler: src/index.handler
Role: "<ROLE_ARN>"
Description: Reads from the DynamoDB Stream and publishes to an SNS topic
Events:
- ReceiveBark:
Type: DynamoDB
Stream: !GetAtt BarkTable.StreamArn
StartingPosition: TRIM_HORIZON
BatchSize: 1
PublishNewBark:
类型:AWS::Serverless::Function
特性:
功能名称:publishNewBark
代码URI:。
处理程序:src/index.Handler
角色:“”
描述:读取DynamoDB流并发布到SNS主题
活动:
-接受者:
类型:发电机B
小溪:!GetAtt BarkTable.StreamArn
启动位置:微调地平线
批量大小:1