I created a service in ECS running a task on many instances for high availability. I created an internal network load balancer and a vpc endpoint, and I registered the service's instances to the nlb's target group. I have an API gateway to receive external requests from the client, and I want to pass these requests to the service and get a response.
I know I can integrate my API Gateway with VPC and attach to the nlb, and it worked. But its not sufficient, and I need to integrate the gateway's endpoint with a lambda to perform more actions on the service responses.
I want to perform a request from the lambda to the vpc/nlb endpoint and get a response from one of the instances, but I cant find anywhere how to do this. Is there a boto3 or any other way to properly invoke a request to the endpoint? like with sagemaker.
Thanks! my aws vpc endpoint description
You can integrate your lambda function with the vpc. This way the lambda function will able to be access private resources in the vpc, including your NLB.
Thus your API gateway will be integrated with the function, which in turn will be integrated with your VPC. The function will invoke your service through NLB and return any response to the API gateway.
There is special no
boto3
functionality to call your NLB. You just use regular python tool for calling your NLB's url, such asrequests
.