Peter Halverson
Peter Halverson

Reputation: 419

Access Api Gateway API operation from VPC?

I am trying to figure out how to access the Api Gateway service API (aka "Manage Amazon API Gateway") from a lambda running in a VPC. Not I'm not trying to invoke an resource method in a private API (I'm aware of how to create an execute-api VPC interface endpoint), just calling an AWS service method (get-api-key, FWIW, using a Python boto3 client). Hope that makes sense, hard to articulate this clearly with so many overloads of "API" here. Current attempts fail with a timeout, so I presume it's VPC-related, but I'm not sure how to provide access. I don't see any obvious endpoint types that would do so. I've seen references to using a NAT gateway for extra-VPC resources, but I'm not clear how (or if) this would apply. The VPC has a NAT Gateway configured, and the Lambda's security group allows all outbound traffic, see configurations below. Appreciate any suggestions.

NAT Gateway Configuration

NAT Gateway Configuration

Lambda Network Configuration Lambda Network Configuration

Upvotes: 1

Views: 1002

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179084

Accessing the Amazon API Gateway Control Plane API endpoints requires Internet access.

Lambda functions in a VPC can't access the Internet without a NAT Gateway or another type of NAT device. See How do I give internet access to my Lambda function in a VPC? ... or provision your Lambda function outside the VPC if it doesn't really need to be inside a VPC. Provisioned outside a VPC, Lambda functions have Internet access automatically.

Upvotes: 3

Related Questions