Disabling the default endpoint for an HTTP API - Amazon API Gateway

Disabling the default endpoint for an HTTP API

By default, clients can invoke your API by using the execute-api endpoint that API Gateway generates for your API. To ensure that clients can access your API only by using a custom domain name, disable the default execute-api endpoint.

Note

When you disable the default endpoint, it affects all stages of an API.

The following AWS CLI command disables the default endpoint for an HTTP API.

aws apigatewayv2 update-api \ --api-id abcdef123 \ --disable-execute-api-endpoint

After you disable the default endpoint, you must deploy your API for the change to take effect, unless automatic deployments are enabled.

The following AWS CLI command creates a deployment.

aws apigatewayv2 create-deployment \ --api-id abcdef123 \ --stage-name dev