'API Gateway HTTP Proxy integration with aws-sam (NOT Lambda Proxy)
I am trying to use aws-sam to develop / simulate my API Gateway locally. My API gateway makes liberal use of the HTTP proxy integrations. The production Resource looks like this:
All of the aws-sam examples which I've found, as well as related documentation and Q&A, use the Lambda integrations / have a hard dependency on a Lambda function being the proxied resource, versus an HTTP Proxy integration.
Is there a way to define an HTTP Proxy resource for an aws-sam application? (As opposed to a Lambda Proxy resource?)
Related:
- Create an API Gateway Proxy Resource using SAM
- I am also attempting to solve the same problem using serverless-offline, at the following post - API Gateway HTTP Proxy integration with serverless-offline (as opposed to a Lambda Proxy)
Solution 1:[1]
Yes, SAM is just a Cloud Formation transform. So you can still create traditional CloudFormation objects as usual. You might be able to also attach it to your Serverless::API but I am less confident about that.
Resource:
Api:
Type: 'AWS::ApiGateway::RestApi'
Properties:
Description: A test API
Name: MyRestAPI
Type: 'AWS::ApiGateway::Resource'
Properties:
ParentId: !GetAtt Api.RootResourceId
RestApiId: !Ref Api
PathPart: '{proxy+}'
or possibly (untested):
Resource:
Api:
Type: 'AWS::Serverless::Api'
Properties:
Description: A test API
Name: MyRestAPI
Type: 'AWS::ApiGateway::Resource'
Properties:
ParentId: !GetAtt Api.RootResourceId
RestApiId: !Ref Api
PathPart: '{proxy+}'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | J.A. Simmons V |

