Lambda - not connected to VPC - has no internet access

0

Hello,

I have created a lambda-function, but it seems to have no internet access. So, I created a new function, just doing a ping. socket.create_connection((host_to_ping, 80), timeout=timeout) response = { 'statusCode': 200, 'body': f'Ping successful {host_to_ping}' }

This always runs into an exception (timeout). I have assigned the AWSLambdaBasicExecutionRole to this lambda.

I had yesterday played around a lot with my VPCs, Subnets, ... and maybe I messed up. But this Lambda is NOT connected to a VPC - so I understand it should have internet access by default?

What could be wrong?

Greetings, Hendrik

Hendrik
已提问 5 个月前190 查看次数
2 回答
1
已接受的回答

Hello.

Looking at the explanation below, I thought that it was not possible to send ICMP packets from Lambda.
Therefore, I think it is probably not possible to ping from Lambda.
https://aws.amazon.com/lambda/faqs/?nc1=h_ls

Q: What restrictions apply to AWS Lambda function code? Lambda attempts to impose as few restrictions as possible on normal language and operating system activities, but there are a few activities that are disabled: Inbound network connections are blocked by AWS Lambda, and for outbound connections, only TCP/IP and UDP/IP sockets are supported, and ptrace (debugging) system calls are blocked. TCP port 25 traffic is also blocked as an anti-spam measure.

profile picture
专家
已回答 5 个月前
profile picture
专家
已审核 11 小时前
profile pictureAWS
专家
已审核 5 个月前
  • Agree with Riku: ping is ICMP and ICMP is not usable in Lambdas

0

Thanks a lot, that explains it!

Hendrik
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容