Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can AWS Lambdas receive inbound TCP connections?

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

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

like image 581
JC1 Avatar asked Feb 27 '18 23:02

JC1


People also ask

Which of the following TCP port traffic is blocked in AWS Lambda by default?

AWS blocks outbound traffic on port 25 (SMTP) of all EC2 instances and Lambda functions by default.

Which services allows a Lambda function to receive requests from an external source?

Amazon Alexa. Amazon API Gateway. Amazon CloudFront (Lambda@Edge) Amazon Kinesis Data Firehose.

Can AWS Lambda functions access internet?

By default, Lambda runs your functions in an internal virtual private cloud (VPC) with connectivity to AWS services and the internet. To access local network resources, you can configure your function to connect to a VPC in your account.


1 Answers

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

Why?

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.

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.

like image 137
Usman Mutawakil Avatar answered Nov 06 '22 06:11

Usman Mutawakil