Description
A REGIONAL REST API is reachable over the internet. Authentication and resource policies determine who can invoke it. For an internal-only API, use PRIVATE to restrict the network path to a VPC endpoint.
Potential impact
A public endpoint lets outside clients discover and send requests to an internal API. When moving an existing API, prepare the private path first so approved clients retain access.
Remediation
- Give public and internal APIs separate access policies.
- Configure an interface VPC endpoint, DNS, and security groups. Allow the intended VPC or endpoint in the API resource policy, and restrict the endpoint policy if needed.
- Set
endpoint_configuration.types = ["PRIVATE"], redeploy the API, and test connectivity and caller authentication from an approved client.
Examples
The excerpts change the endpoint type of the same REST API. Methods and authentication are omitted.
Before
hcl
resource "aws_api_gateway_rest_api" "example" {
name = "regional-example"
endpoint_configuration {
types = ["REGIONAL"]
}
}
After
hcl
resource "aws_api_gateway_rest_api" "example" {
name = "regional-example"
endpoint_configuration {
types = ["PRIVATE"]
}
}
REGIONAL is reachable from the internet. PRIVATE requires a VPC endpoint and an API resource policy that allows that path.