AWS Lambda可以接收入站TCP连接吗? [英] Can AWS Lambdas receive inbound TCP connections?

查看:87
本文介绍了AWS Lambda可以接收入站TCP连接吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使AWS Lambda接收入站TCP连接(例如从另一个lambda)吗?

Is there any way to make an AWS lambda receive an inbound TCP connection (for instance from another lambda)?

我不是在问是否有可能从另一个调用lambda.

I'm not asking whether it's possible to call a lambda from another.

推荐答案

不直接.您只能通过HTTP/HTTPS通过API网关来建立与Lambda的连接.将为您的lambda函数提供一个HTTP端点,但此解析为的IP地址仍然是API网关,而不是您的lambda函数.通过http请求调用AWS Lambda函数

No not directly. You can only make a connection to Lambda by going through API gateway via HTTP/HTTPS. Your lambda function will be given an HTTP endpoint but the IP address this resolves to is still API gateway and not your lambda function. Invoke a AWS Lambda function by a http request

为什么?

我怀疑是因为每个lambda函数与位于VM上的许多其他lambda函数共享其IP地址.它们在EC2实例之上的容器上运行,因此您将有多个客户在同一IP地址上运行.我没有看到详细说明AWS实际工作的文档,但是我猜每个容器都在不同的端口上运行,因此要直接连接到容器,您需要知道当前"端口,而不仅仅是IP地址.最重要的是,没有理由为容器提供公共IP地址.它们可能都生活在专用子网中.

I suspect its because each lambda function shares its IP address with lots of other lambda functions located on the VM. They run on containers on top of EC2 instances so you would have several customers running on the same IP address. I've seen no documentation detailing what AWS is really doing but I would guess each container runs on a different port so for you to connect directly to your container you'd need to know the "current" port and not just the IP address. Ontop of that, theres no reason to give the containers public IP addresses. They all probably live in a private subnet.

如果您想要更多确认,则可以浏览AWS Lambda控制台,除了API网关的HTTP终结点外,没有其他lambda属性.而且,如果您搜索SDK文档,那么您将不会遇到任何IP地址检索功能.

If you want more confirmation you can explore the AWS lambda console and find no lambda properties other than the HTTP endpoint for API gateway. And if you google the SDK docs you won't come across any IP address retrieval functions.

这篇关于AWS Lambda可以接收入站TCP连接吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆