我正在尝试通过 cloudformation 创建一个 api 网关,该网关使用 vpc 链接到内部 beanstalk 网络负载均衡器:
这是我创建 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 中设置 VPCLink::ApiGateway::Method 正在进行中。截至目前,支持的选项是使用招摇模板创建具有VPCLink集成的RestAPI