Amazon API Gateway Mock Integration built with CloudFormation

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

CloudFormation Stack

OpenAPI AWS Specification

---
swagger: "2.0"
info:
  title: "elysium"
schemes:
- "https"
paths:
  /a:
    get:
      consumes:
      - "application/json"
      produces:
      - "application/json"
      responses:
        200:
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: "200"
        passthroughBehavior: "when_no_match"
        requestTemplates:
          application/json: "{\"statusCode\": 200}"
        type: "mock"
definitions:
  Empty:
    type: "object"
    title: "Empty Schema"

Procedure

  • Copy the OpenAPI AWS metadata file in S3.
  • Deploy the stack:
aws cloudformation deploy --stack-name elysium