- 新しい順
- 投票が多い順
- コメントが多い順
Hi.
For a lambda in a customer vpc, to connect to an API gateway, you do not need a NAT Gateway.
API gateway is a regional service, and it allows to communicate with lambdas in customer vpc without any problem, as API GW uses the public lambda API.
A Nat gateway is to be used if your lambda, in a private subnet, wants to communicate with some on the internet, like a rest API.
If your lambda must be in private vpc, and you need outbound/egress communication with the internet, then you have to use Nat gateway.
If your lambda needs to talk to some internal aws services, then vpc endpoints via private link is the way to go: https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html
API-GW can connect to Lambda function inside A VPC.
But for lambda inside a private subnet inside a VPC , to access external resources you can use a NAT instanceinternet access to lambda in vpc instead of a NAT gateway if you are worried about NAT Gateway cost but do review the different between them here
You can also create a NAT Instance from a NAT AMI see this link
Also review this link on the functions execution role permissions and other aspects
HTH
Thank you for the answers, I will connect the lambda in the vpc without to a nat gateway to the api gateway. Hopefully that works out in this use case, if not, I will explore the nat instance. Thank you
Additional information, here is documentation on creating an Interface VPC endpoint for API Gateway: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-apis.html