Review the exposure of an API Gateway REST API

Make internal APIs callable only from the networks that need them.

Description

Choose PRIVATE for an internal REST API, or EDGE or REGIONAL when clients need internet access. The endpoint type sets the network path. Caller authorization is a separate setting.

Potential impact

A public path lets external clients reach an internal API. Missing permission checks may then expose data or functions.

Remediation

Prepare the interface VPC endpoint, its security group, client DNS and connectivity. Limit the API resource policy to the approved VPCs or endpoints. Test connectivity and authentication from an approved client.

Examples

The excerpts omit my_api.yml, networking and policies. Ansible applies endpoint_type only when it creates an API. For an existing API, use the supported AWS conversion procedure and redeploy.

Before

yaml
- name: Setup AWS API Gateway
  community.aws.aws_api_gateway:
    swagger_file: my_api.yml
    stage: production
    endpoint_type: EDGE
    state: present

endpoint_type: EDGE creates an internet-facing endpoint. Authentication and access policies determine whether anonymous calls succeed.

After

yaml
- name: Setup AWS API Gateway
  community.aws.aws_api_gateway:
    swagger_file: my_api.yml
    stage: production
    endpoint_type: PRIVATE
    state: present

endpoint_type: PRIVATE creates an API that clients reach through a VPC endpoint.

References