AWS API Gateway: Create one API for both public access and private access

Viewed 273

I would like to achieve these below. What are good ways?

  • Make one API on API Gateway. (I prefer one API over two APIs to save maintenance cost.)
  • The API can be accessed from the internet.
  • The API can be accessed from the VPC without data transfer out charges. (https://aws.amazon.com/api-gateway/pricing/ "There are no data transfer out charges for Private APIs.")

Problems I face to

  • In API Gateway settings, I can choose either "Regional" or "Private" (never both).

Expected structure Expected structure

1 Answers

It is not possible to create one AWS REST API Gateway which is both private and public (either regional or edge optimized). You will have to create two separate API Gateways. You can have the same configurations in both API Gateways in terms of backend integrations.

If you try to specify two endpoint types for the CreateRestAPI operation when using a SDK/CLI you would get the following error:

An error occurred (BadRequestException) when calling the CreateRestApi operation: Cannot create an api with multiple Endpoint Types.

Related