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
feita há 4 meses180 visualizações
2 Respostas
0
Resposta aceita

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
ESPECIALISTA
respondido há 4 meses
profile pictureAWS
ESPECIALISTA
avaliado há 4 meses
  • Agree with Riku: ping is ICMP and ICMP is not usable in Lambdas

0

Thanks a lot, that explains it!

Hendrik
respondido há 4 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas