AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Log Example Globals: Function: Timeout: 3 Resources: MyHttpApi: Type: AWS::Serverless::HttpApi Properties: AccessLogSettings: DestinationArn: !GetAtt MyLogGroup.Arn Format: '{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","routeKey":"$context.routeKey", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength", "integrationError":"$context.integrationErrorMessage" }' CorsConfiguration: AllowMethods: - GET AllowOrigins: - http://localhost:8080 MyLogGroup: Type: AWS::Logs::LogGroup HelloWorldFunction: Type: AWS::Serverless::Function Properties: CodeUri: src/ Handler: app.lambdaHandler Runtime: nodejs12.x Events: HelloWorld: Type: HttpApi Properties: Path: / Method: GET ApiId: !Ref MyHttpApi Outputs: HelloWorldApi: Description: "API Gateway endpoint URL for Prod stage for Hello World function" Value: !Sub "https://${MyHttpApi}.execute-api.${AWS::Region}.amazonaws.com"