I'm deploying a REST API on API Gateway accessing a web service on Fargate via a VPC Link and an NLB. And this actually works.
[API Gateway] <-> [VPC Link] <-> { [NLB] <-> [Fargate] }
# { ... private subnet ... }
The only missing piece is deploying the method:resource ANY:test/. That part is described in below code snippet:
vpc_link = api.VpcLink(
self,
"VpcLinkRaffael",
targets=[fg.load_balancer],
)
rest_api = api.RestApi(
self,
"RestApiRaffael",
)
test = rest_api.root.add_resource("test")
test.add_method(
"ANY",
# the following integration setting is causing the problem. for the previous deployment
# I left this specific parameter out and it deployed fine. so my deployment at this point
# is a rest API with a resource test and method ANY.
api.Integration(
type=api.IntegrationType.HTTP_PROXY,
options=api.IntegrationOptions(
vpc_link=vpc_link
),
uri="http://example.org/",
),
)
This causes the error:
0/5 | 4:57:57 PM | UPDATE_IN_PROGRESS | AWS::ApiGateway::Method | RestApiRaffael/Default/test/ANY (RestApiRaffaeltestANY0602E478)
1/5 | 4:57:58 PM | UPDATE_FAILED | AWS::ApiGateway::Method | RestApiRaffael/Default/test/ANY (RestApiRaffaeltestANY0602E478) Enumeration value for HttpMethod must be non-empty (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 0a6b9f7d-4501-41e0-8e4a-cbebd0fb1333)
new Method (/tmp/jsii-kernel-g0iRHB/node_modules/@aws-cdk/aws-apigateway/lib/method.js:45:26)
\_ Resource.addMethod (/tmp/jsii-kernel-g0iRHB/node_modules/@aws-cdk/aws-apigateway/lib/resource.js:17:16)
\_ /home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7665:51
\_ Kernel._wrapSandboxCode (/home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:8298:20)
\_ /home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7665:25
\_ Kernel._ensureSync (/home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:8274:20)
\_ Kernel.invoke (/home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7664:26)
\_ KernelHost.processRequest (/home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7372:28)
\_ KernelHost.run (/home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7312:14)
\_ Immediate._onImmediate (/home/raffael/gitrepos/test-api-elb-fargate/env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7315:37)
\_ processImmediate (internal/timers.js:456:21)
Before this erroneous deployment I just deployed the RESt API with ANY test/. No problem. So, I can actually go on API Gateway and manually configure:
https://imgur.com/mpSBm8B
- Integration Type: VPC Link
- Use Proxy Integration: Yes
- Method: ANY
- VPC Link: added
- Endpoint URL: http://example.org/
That works. Now what I would like to do is reproduce this with CDK and I think that should be done by adding:
api.Integration(
type=api.IntegrationType.HTTP_PROXY,
options=api.IntegrationOptions(
vpc_link=vpc_link
),
uri="http://example.org/",
),
That's what I am doing above but causes the error. Any ideas what I'm doing wrong?
I'm deploying a REST API on API Gateway accessing a web service on Fargate via a VPC Link and an NLB. And this actually works.
The only missing piece is deploying the method:resource ANY:test/. That part is described in below code snippet:
This causes the error:
Before this erroneous deployment I just deployed the RESt API with ANY test/. No problem. So, I can actually go on API Gateway and manually configure:
https://imgur.com/mpSBm8B
That works. Now what I would like to do is reproduce this with CDK and I think that should be done by adding:
That's what I am doing above but causes the error. Any ideas what I'm doing wrong?