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 個答案
0

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

profile pictureAWS
專家
kentrad
已回答 2 年前
0
  • 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

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南