Review API Gateway endpoint exposure

Restrict the network path and invocation permissions of internal APIs to the required scope.

Description

Use EDGE or REGIONAL for REST APIs that need internet reachability. For internal APIs, PRIVATE limits the network path. Keep method authentication and application permission checks in place.

Potential impact

A public path with insufficient access checks may expose internal functions. Switching before private connectivity is ready can also disconnect existing clients.

Remediation

Prepare an interface VPC endpoint, security groups and DNS. Set the API resource policy to allow the required VPCs or endpoints. Change the endpoint type, redeploy and test connectivity and authentication for approved clients.

Examples

The excerpts compare EndpointConfiguration.Types on the same REST API. They omit the VPC endpoint, resource policy, methods and authentication settings.

Before

yaml
Resources:
  InternalApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: internal-api
      EndpointConfiguration:
        Types:
          - EDGE

EDGE provides a public path. Authentication and access policies determine who can call the API.

After

yaml
Resources:
  InternalApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: internal-api
      EndpointConfiguration:
        Types:
          - PRIVATE

PRIVATE routes calls through a VPC endpoint.

References