簡體   English   中英

如何通過CloudFormation附加VPC鏈接以獲取API網關中的方法

[英]How to attach vpc link to get method in api gateway via cloudformation

我試圖通過cloudformation創建一個api網關,該網關使用到內部beantalk網絡負載均衡器的vpc鏈接:

這是我創建vpc鏈接的代碼:

  VpcLink:
  Type: AWS::ApiGateway::VpcLink
  Properties:
      Description: vpc link
      Name: channel-vpc-link
      TargetArns:
          - !ImportValue channel-dns-arn

這是我的api gtw代碼:

GetMethod:
Type: AWS::ApiGateway::Method
DependsOn: VpcLink
Properties:
  AuthorizationType: NONE
  HttpMethod: GET
  #RequestParameters:
  #  method.request.path.proxy: true
  Integration:
    Type: HTTP
    IntegrationHttpMethod: GET
    Uri:
      Fn::Join:
      - ''
      - - "http://"
        - ${stageVariables.channelUrl}
        - "/channels"
        - "/stories"
    IntegrationResponses:
    - StatusCode: 200
      ResponseParameters:
        method.response.header.Access-Control-Allow-Origin: "'*'"
      ResponseTemplates:
        application/json: ''
    RequestTemplates:
      application/json: ''
  ResourceId: !Ref ChannelsStoriesPath
  RestApiId:
    Ref: RestApi
  MethodResponses:
  - StatusCode: 200
    ResponseParameters:
        method.response.header.Access-Control-Allow-Origin: true

效果很好,但問題是我無法找到一種方法來附加我先前在get方法代碼中創建的vpc鏈接。 如何通過vpc鏈接設置get方法?

我找到了此鏈接,但根本沒有幫助

https://forums.aws.amazon.com/thread.jspa?threadID=275511

支持在AWS :: ApiGateway :: Method中設置VPCLink的工作正在進行中。 截至目前,支持的選項是使用swagger模板通過VPCLink集成創建RestAPI

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM