0

모든 HTTP 매개 변수, 헤더 및 본문을 다른 HTTP 끝점에 매핑하는 방법이 있습니까? 특별한 템플릿이 필요합니까?API Gateway는 input passthrough serverless 1.x와 http 통합을 구성합니다.

이것은 내가 지금까지있어 무엇 :

functions: 
    myfunction: 
    handler: lambda.myfunction # dummy hanlder 
    events:  
     - http: 
      path: resource/{resourceId}/other 
      method: get 
      integration: HTTP 
      request: 
      uri: http://url/resource/{resourceId}/other 
      parameters: 
       'method.request.path.resourceId': true 
       'method.request.header.my-header': true 
      response: 
      statusCodes: 
       200: 
       pattern: '' 

내가 패스 스루 옵션은 기본적으로 활성화되어 콘솔에서 직접 생성하고 올바르게 resourceId를 매핑 할 때마다.

설명서를 살펴 보려고했지만 http 통합에 대한 설명서가 거의없는 것으로 보입니다.

답변

0

이 해결 방법을 찾을 수 있었지만 올바른 해결 방법보다 더 많은 해결 방법이 있습니다.

이 작업을 수행하려면 serverless.yml의 자원에 Integration.RequestParameters을 설정해야했습니다.

resources: 
    Resources: 
    ApiGatewayMethodV1ResourceResourceidVarOtherGet: 
    Properties: 
     RequestParameters: 
     method.request.path.resourceId: true 
     method.request.header.my-header: true 
     Integration: 
     RequestParameters: 
      integration.request.path.resourceId: method.request.path.resourceId 
      integration.request.header.my-header: method.request.header.my-header 
1

다른 HTTP 엔드 포인트에 대한 모든 매개 변수, 헤더와 본문을지도 할 수있는 방법이 있습니까? 특별한 템플릿이 필요합니까?

예, HTTP_PROXY 통합 유형을 사용하십시오. 콘솔에서 이것은 통합 요청 페이지의 선택란입니다.

+0

앞으로는 이것을 vpc 링크로 변경하려고합니다. http-proxy 및 vpc 링크가 승인자 정보를 전달합니까? – dege

+0

예, VPC 링크는 통합 유형과 독립적이므로 HTTP_PROXY 또는 HTTP를 선택할 수 있습니다. –