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
gefragt vor 5 Monaten190 Aufrufe
2 Antworten
1
Akzeptierte Antwort

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
EXPERTE
beantwortet vor 5 Monaten
profile picture
EXPERTE
überprüft vor 2 Tagen
profile pictureAWS
EXPERTE
überprüft vor 5 Monaten
  • Agree with Riku: ping is ICMP and ICMP is not usable in Lambdas

0

Thanks a lot, that explains it!

Hendrik
beantwortet vor 5 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen