1
votes

I am trying to call my private API gateway from a lambda function in another AWS account. But i am getting timeout while making the call (Actually the http call is just stuck and hits my client side timeout).

In the AWS account which hosts the private AWS account i did the following * Created my private API gateway and lambda behind the API

  • Create resource policy and provided access to the VPC endpoint of the other AWS caller (caller)
  • create VPC endpoint with private DNS enabled.
  • Attached policy to VPC endpoint with full access, security group with access to all traffic.

In the second AWS account (caller) i did the following * Create VPC and VPC endpoint for API gateway with full access.

  • created lambda in the VPC with security group with access to all traffic (inbound and outbound)
  • In lambda I am using the public DNS of the VPC endpoint(Account 1) and used header 'x-apigw-api-id'

I already tried the debugging steps mentioned in this page https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-private-endpoint-connection/. Also tried whitelisting based on the VPC ID instead of VPC endpoint ID.

Any suggestions for resolving this issue.

1
Hi. So you have 2 accounts and 2 vpcs (one in each account). Based on your description I don't see any cross-account peering connection between the 2 VPCs. Do you have such a connection?Marcin
@Marcin No, i don't have a VPC peering connection. Is that required for this ? In the AWS doc aws.amazon.com/premiumsupport/knowledge-center/… it say we need peering connection only if the API are in different regionsuser2088083
You are right. If its the same account, a peering connection is not required.Marcin
Does Lambda in the caller account have proper execution role for vpc access?Marcin
wow, thanks for trying out. I justed figured out the issue. I was using the VPC endpoint of the other account while making a call. That fixed the issueuser2088083

1 Answers

0
votes

Just found the isssue. I was using the VPC endpoint of the other aws account while making a call. When i used the VPC endpoint of the same account it worked.