Failed to send request - Lambda can't connect to External API

0

I have two lambda functions. One connects to an ECS instance using a VPC. The second should also connect to that same ECS instance and an API (api.twitter.com). The first function works perfectly, i've been able to write and read from files within the instance. However, the second can connect to the API without the VPC, but immediately the VPC is added it gives me a

"errorMessage": "Failed to send request: HTTPSConnectionPool(host='api.twitter.com', port=443)

About my VPC

  • I have 2 public subnets and 2 private subnets - in two separate availability zones
  • I have an Internet gateway attached to my VPC
  • I have 2 route tables(public and private
  • My internet gateway is routed to my public route table
  • I also have an NAT gateway connected to my public subnet
  • That NAT gateway is routed to my private route table

I have gone back and forth with all the connections highlighted above trying to solve this issue. I need my function to access ECS and also connect to the internet API. Please help me.

  • I am facing the exact same issue, the lambda with vpc connected cannot request to external network (verify google recaptcha). I basically have the same VPC configuration with you. Did you find any solutions?

2 Risposte
0

What does the Security Group for the Lambda function look like?

profile pictureAWS
ESPERTO
kentrad
con risposta 2 anni fa
0
profile pictureAWS
con risposta 2 anni fa
  • Yes, that has been my guide i honestly don't know where i'm missing it. But i guess i have to do more troubleshooting

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande