Home > database >  How to change settings for auto generated resources SAM AWS
How to change settings for auto generated resources SAM AWS

Time:08-03

I'm implemented SAM template with AWS::Serverless::Api:

    Type: AWS::Serverless::Api
    Properties:
      Name:
        Fn::Sub: ${AppName}-${ServiceName}
      StageName: !Ref Stage
    ...

AWS Developers guide says:

"When an AWS::Serverless::Api is specified, AWS Serverless Application Model (AWS SAM) always generates an AWS::ApiGateway::RestApi base AWS CloudFormation resource. In addition, it also always generates an AWS::ApiGateway::Stage and an AWS::ApiGateway::Deployment resource."

So, my question is how can I change within SAM template autogenerated resources settings? For example, I want to change LoggingLevel for the ApiGateway.Stage. Thanks.

CodePudding user response:

Have a look at methodSettings: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-api.html#sam-api-methodsettings

Example:

    Type: AWS::Serverless::Api
    Properties:
       StageName: mine
       MethodSettings:
        - HttpMethod: ...
          ResourcePath: ...
          LoggingLevel: ERROR
          ...
  • Related