amazon-web-services - how to invoke a request to a network load balancer(nlb) vpc endpoint from a lambda function in aws
问题描述
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
解决方案
您可以将 lambda 函数与 vpc 集成。这样,lambda 函数将能够访问 vpc 中的私有资源,包括您的 NLB。
因此,您的 API 网关将与该功能集成,而该功能又将与您的 VPC 集成。该函数将通过 NLB 调用您的服务并将任何响应返回给 API 网关。
没有特殊boto3
的功能可以调用您的 NLB。您只需使用常规 python 工具来调用您的 NLB 的 url,例如requests
.
推荐阅读
- r - 如果在字符向量元素中找不到正则表达式匹配,如何返回 NULL?
- ios - 如果一个发布者没有产生任何值,如何让 CombineLatest3 返回结果?
- android - 为什么 Android Studio 中的 Image Asset 工具不会为 xxxhdpi 文件夹生成 PNG 文件?
- uwp - 如何使用 Windows Cloud Sync Engine API 支持删除?
- java - 需要从使用 java 3.12.0 驱动程序的 java 应用程序中的 mongoDB Atlas 中获取具有相同 first_name 的客户的 customerID 列表
- python - 为什么我的表单没有保存到管理数据库?
- python - 没有响应和程序冻结
- javascript - 无论值如何,如何从选择器中排除具有属性的元素
- c# - 清理验证码图像,然后使用 Tesseract OCR (.NET)
- c++ - 向没有 SFINAE 的类模板添加专门的方法