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
エキスパート
レビュー済み 1日前
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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ