--- AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Multi-regional HelloWorld. Resources: HelloWorldApi: Type: AWS::Serverless::Api Properties: StageName: prod DefinitionBody: swagger: "2.0" info: version: "2016-12-09T04:29:17Z" title: multiregion-helloworld basePath: "/prod" schemes: - "https" paths: /helloworld: get: consumes: - "application/json" produces: - "application/json" responses: "200": description: "200 response" schema: $ref: "#/definitions/Empty" headers: Access-Control-Allow-Origin: type: "string" x-amazon-apigateway-integration: responses: default: statusCode: "200" responseParameters: method.response.header.Access-Control-Allow-Origin: "'*'" uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetHelloworld.Arn}/invocations passthroughBehavior: "when_no_templates" httpMethod: "POST" contentHandling: "CONVERT_TO_TEXT" type: "aws" options: consumes: - "application/json" produces: - "application/json" responses: "200": description: "200 response" schema: $ref: "#/definitions/Empty" headers: Access-Control-Allow-Origin: type: "string" Access-Control-Allow-Methods: type: "string" Access-Control-Allow-Headers: type: "string" x-amazon-apigateway-integration: responses: default: statusCode: "200" responseParameters: method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'" method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'" method.response.header.Access-Control-Allow-Origin: "'*'" requestTemplates: application/json: "{\"statusCode\": 200}" passthroughBehavior: "when_no_match" type: "mock" /healthcheck: get: consumes: - "application/json" produces: - "application/json" responses: "200": description: "200 response" schema: $ref: "#/definitions/Empty" headers: Access-Control-Allow-Origin: type: "string" x-amazon-apigateway-integration: responses: default: statusCode: "200" responseParameters: method.response.header.Access-Control-Allow-Origin: "'*'" uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetHealthcheck.Arn}/invocations passthroughBehavior: "when_no_templates" httpMethod: "POST" contentHandling: "CONVERT_TO_TEXT" type: "aws" options: consumes: - "application/json" produces: - "application/json" responses: "200": description: "200 response" schema: $ref: "#/definitions/Empty" headers: Access-Control-Allow-Origin: type: "string" Access-Control-Allow-Methods: type: "string" Access-Control-Allow-Headers: type: "string" x-amazon-apigateway-integration: responses: default: statusCode: "200" responseParameters: method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'" method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'" method.response.header.Access-Control-Allow-Origin: "'*'" requestTemplates: application/json: "{\"statusCode\": 200}" passthroughBehavior: "when_no_match" type: "mock" definitions: Empty: type: "object" title: "Empty Schema" GetHelloworld: Type: AWS::Serverless::Function Properties: CodeUri: . Handler: get_helloworld.lambda_handler Runtime: python2.7 Events: GetResource: Type: Api Properties: RestApiId: !Ref HelloWorldApi Path: /helloworld Method: get GetHealthcheck: Type: AWS::Serverless::Function Properties: CodeUri: . Handler: get_healthcheck.lambda_handler Runtime: python2.7 Environment: Variables: STATUS: "ok" Events: GetResource: Type: Api Properties: RestApiId: !Ref HelloWorldApi Path: /healthcheck Method: get Outputs: RestAPIID: Description: Rest API ID Value: !Ref HelloWorldApi HealthcheckApiUrl: Description: URL of your API endpoint Value: !Join - '' - - https:// - !Ref HelloWorldApi - '.execute-api.' - !Ref 'AWS::Region' - '.amazonaws.com/prod'