I took the HTTP proxy example and modified to implement MOCK integration until it matched what I wanted. I used the solution suggested here to pass in secrets: Storing Database credentials securely
If your method is anything other than a basic GET or POST, an OPTIONS method for CORS will also be needed.
resources:
Resources:
MockResource:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Fn::GetAtt:
- ApiGatewayRestApi # our default Rest API logical ID
- RootResourceId
PathPart: yourpath # the endpoint in your API that is set as proxy
RestApiId:
Ref: ApiGatewayRestApi
MockMethod:
Type: AWS::ApiGateway::Method
Properties:
AuthorizationType: None
HttpMethod: GET
ResourceId:
Ref: MockResource
RestApiId:
Ref: ApiGatewayRestApi
MethodResponses:
- ResponseModels:
application/json: Empty
ResponseParameters:
method.response.header.Access-Control-Allow-Origin: true
StatusCode: 200
Integration:
RequestTemplates:
application/json: |
{"statusCode": 200}
Type: MOCK
IntegrationResponses:
- ResponseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
ResponseTemplates:
application/json: |
{
"number": 12345,
"data": {
"identitypool": "${self:custom.secrets.IDENTITYPOOL}",
"region": "${self:custom.secrets.REGION}",
"poolclient": "${self:custom.secrets.POOLCLIENT}",
"userpool": "${self:custom.secrets.USERPOOL}"
}
}
StatusCode: 200