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 Answers
0

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

profile pictureAWS
EXPERT
kentrad
answered 2 years ago
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

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions