首页 文章

AWS SAM模板创建API

提问于
浏览
2

我正在使用以下SAM模板进行lambda函数

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  GetFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: handler.get
      Runtime: nodejs6.10
      Environment:
        Variables: 
          S3_BUCKET: bucket
      Events:
        GetResource:
          Type: Api
          Properties:
            Path: /resource/{resourceId}
            Method: get

我对事件部分感到有点困惑 . 当我部署它时,lambda函数被创建得很好,但是因为我在事件中提到Api我希望它创建一个API网关 . 但是,当我导航到API网关部分https://console.aws.amazon.com/apigateway/时,我没有看到任何API网关创建 . 当我导航到CloudFormation堆栈并查看模板时,它会显示API网关,但是它不会显示正在创建的模板 . 我在这里错过了什么?

1 回答

  • 0

    似乎SAM模板中没有问题 . 你有没有看过堆栈细节的参考资料部分?应该有一个 AWS::ApiGateway::RestApi 类型的资源以及物理ID和状态 . 您也可以尝试删除堆栈并重新部署它 .

    enter image description here

相关问题