Amazon SAM 模板,用于 API Gateway 应用程序
下面是教程中 Lambda 应用程序的示例 Amazon SAM 模板。将以下文本复制到一个文件中,并将该文件保存到您之前创建的 ZIP 程序包旁。请注意,Handler
和 Runtime
参数值应与上一节中创建函数时所用的参数值匹配。
例 template.yaml
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Resources: LambdaFunctionOverHttps: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: nodejs18.x Policies: AmazonDynamoDBFullAccess Events: HttpPost: Type: Api Properties: Path: '/DynamoDBOperations/DynamoDBManager' Method: post
有关如何使用程序包和部署命令打包和部署无服务器应用程序的信息,请参阅 Amazon Serverless Application Model 开发人员指南中的部署无服务器应用程序。