如何定义没有类型的阶段名称:AWS :: Serverless :: Api?

时间:2018-06-26 01:43:49

标签: aws-sam

我不想用招摇,所以我的模板如下。

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: my api
Globals:
  Api:

    Cors:
      AllowMethods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
      AllowHeaders: "'Content-Type, Authorization'"
      AllowOrigin: "'*'"
      MaxAge: "'600'" 

    MethodSettings:
      - ResourcePath: "/*"
        HttpMethod: "*"
        CacheDataEncrypted: false
        CachingEnabled: false
        DataTraceEnabled: true
        LoggingLevel: INFO
        MetricsEnabled: true
        ThrottlingBurstLimit: 50
        ThrottlingRateLimit: 100

Resources:

  GetUsers:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: get-users
      CodeUri: bin/user/list/list.zip
      Role: !Sub arn:aws:iam::${AWS::AccountId}:role/lambda_basic_execution
      Handler: list
      Runtime: go1.x
      VpcConfig:
        SecurityGroupIds:
          - sg-xxxx
        SubnetIds:
          - subnet-xxx
      Events:
        GetResource:
          Type: Api
          Properties:
            Path: /users
            Method: get

通过这种方式,将使用我在Globals> Api下定义的设置创建一个名为Prod的阶段。 (我知道存在一个错误,即创建了一个名为Stage的舞台。我现在不在乎)
现在,我想更改名称Prod,还想定义多个阶段。我该怎么办?

0 个答案:

没有答案