How to attach vpc link to get method in api gateway via cloudformation
How to attach vpc link to get method in api gateway via cloudformation
I am trying to create a api gateway via cloudformation which use a vpc link to an internal beanstalk network load balancer:
Here is my code to create vpc link:
VpcLink:
Type: AWS::ApiGateway::VpcLink
Properties:
Description: vpc link
Name: channel-vpc-link
TargetArns:
- !ImportValue channel-dns-arn
and here is my api gtw code:
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
which works fine but the problem is I am not able to find a way to attach the vpc link I created earlier in the get method code. How can I set the get method through vpc link?
I found this link but was not helpful at all
https://forums.aws.amazon.com/thread.jspa?threadID=275511
1 Answer
1
Support for setting VPCLink in AWS::ApiGateway::Method is work in progress. As of now supported option is to use swagger template to create RestAPI with VPCLink integration
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thanks. Use swagger via cloud formation?
– Hamed Minaee
Jul 2 at 14:59