Menu
Amazon API Gateway
Developer Guide

Update an API Endpoint Type in API Gateway

Updating an API endpoint type requires you to update the API's configuration. You can update an existing API type from edge-optimized to regional, and vice-versa, using the API Gateway console, AWS CLI, an AWS SDK for API Gateway, or the API Gateway REST API. The update operation may take up to 60 seconds to complete.

An edge-optimized API may have different behaviors than a regional API. For example, an edge-optimized API removes the Content-MD5 header. Any MD5 hash value passed to the backend can be expressed in a request string parameter or a body property. However, the regional API passes this header through, although it may remap the header name to some other name. Understanding the differences helps you decide how to update an edge-optimized API to a regional one or from a regional API to an edge-optimized one.

Use the API Gateway Console to Update an API Endpoint

  1. Sign in to the console and choose APIs in the primary navigation pane.

  2. Choose the settings (gear icon) of an API under + Create API.

    
                        Update API endpoint in console
  3. Change the Endpoint Type option under Endpoint Configuration from Edge Optimized to Regional or from Regional to Edge Optimized.

  4. Choose Save to start the update.

Use the AWS CLI to Update an API Endpoint

To use the AWS CLI commands to update an edge-optimized API of {api-id}, call the restapi:update as follows:

Copy
aws apigateway update-rest-api \ --rest-api-id {api-id} --patch-operations op=replace,path=/endpointConfiguration/types/EDGE,value=REGIONAL

The successful response has a status code of 200 OK and a payload similar to the following:

Copy
{ "createdDate": "2017-10-16T04:09:31Z", "description": "Your first API with Amazon API Gateway. This is a sample API that integrates via HTTP with our demo Pet Store endpoints", "endpointConfiguration": { "types": "REGIONAL" }, "id": "0gsnjtjck8", "name": "PetStore imported as edge-optimized" }

Conversely, update a regional API to an edge-optimized API as follows:

Copy
aws apigateway update-rest-api \ --rest-api-id {api-id} --patch-operations op=replace,path=/endpointConfiguration/types/REGIONAL,value=EDGE

Because put-rest-api is for updating API definitions, it is not applicable to updating an API endpoint type.

Use the API Gateway REST API to Update an API Endpoint

To use the API Gateway REST API to update an edge-optimized API of {api-id}, call the restapi:update as follows:

Copy
PATCH /restapis/{api-id} { "patchOperations" : [{ "op" : "replace", "path" : "/endpointConfiguration/types/EDGE", "value" : "REGIONAL" }] }

The successful response has a status code of 200 OK and a payload similar to the following:

Copy
{ "createdDate": "2017-10-16T04:09:31Z", "description": "Your first API with Amazon API Gateway. This is a sample API that integrates via HTTP with our demo Pet Store endpoints", "endpointConfiguration": { "types": "REGIONAL" }, "id": "0gsnjtjck8", "name": "PetStore imported as edge-optimized" }

Conversely, to update a regional API to an edge-optimized API, call the restapi:update as follows:

Copy
PATCH /restapis/{api-id} { "patchOperations" : [{ "op" : "replace", "path" : "/endpointConfiguration/types/REGIONAL", "value" : "EDGE" }] }

Because restapi:put is for updating API definitions, it is not applicable to updating an API endpoint type.