Amazon API Gateway
Developer Guide

Create and Test an API with HTTP Proxy Integration

In this tutorial, we will create an API to integrate with the PetStore website through a proxy resource using the HTTP proxy integration.

Create an API with HTTP Proxy Integration

The following procedure walks you through the steps to create and test an API with a proxy resource for an HTTP backend using the API Gateway console. The HTTP backend is the PetStore website ( from Build an API Gateway API to Expose an HTTP Endpoint.

To build an API with HTTP Proxy Integration with the PetStore website through a proxy resource

  1. Sign in to the API Gateway console at

  2. To create an API, choose Create new API (for creating the first API) or Create API (for creating any subsequent API). Next, do the following:

    1. Choose New API.

    2. Type a name in API Name .

    3. Optionally, add a brief description in Description.

    4. Choose Create API.

    For this tutorial, use ProxyResourceForPetStore for the API name.

  3. To create a child resource, choose a parent resource item under the Resources tree and then choose Create Resource from the Actions drop-down menu. Then, do the following in the New Child Resource pane.

    1. Select the Configure as proxy resource option to create a proxy resource. Otherwise, leave it de-selected.

    2. Type a name in the Resource Name* input text field.

    3. Type a new name or use the default name in the Resource Path* input text field.

    4. Choose Create Resource.

    5. Select Enable API Gateway CORS, if required.

    For this tutorial, select Configure as proxy resource. For Resource Name, use the default, proxy. For Resource Path, use /{proxy+}. Select Enable API Gateway CORS.

  4. To set up the ANY method for integration with the HTTP back end, do the following:

    1. Choose HTTP Proxy for Integration type.

    2. Type an HTTP back-end resource URL in Endpoint URL.

    3. Choose Save to finish configuring the ANY method.

    For this tutorial, use{proxy} for the Endpoint URL.

Test an API with HTTP Proxy Integration through Proxy Resource

In the API we just created, the API's proxy resource path of {proxy+} becomes the placeholder of any of the backend endpoints under For example, it can be petstore, petstore/pets, and petstore/pets/{petId}. The ANY method serves as a placeholder for any of the supported HTTP verbs at run time. These are illustrated in the following testing procedure.

To test an API integrated with the PetStore website using HTTP proxy integration through the proxy resource

  1. To use the API Gateway console to test invoking the API, do the following.

    1. Choose ANY on a proxy resource in the Resources tree.

    2. Choose Test in the Method Execution pane.

    3. From the Method drop-down list, choose an HTTP verb supported by the back end.

    4. Under Path, type a specific path for the proxy resource supporting the chosen operation.

    5. If required, type a supported query expression for the chosen operation under the Query Strings heading.

    6. If required, type one or more supported header expressions for the chosen operation under the Headers heading.

    7. If configured, set the required stage variable values for the chosen operation under the Stage Variables heading.

    8. If prompted and required, choose an API Gateway-generated client certificate under the Client Certificate heading to the operation to be authenticated by the back end.

    9. If prompted, type an appropriate request body in the text editor under the Request Body heading.

    10. Choose Test to test invoking the method.

    For this tutorial, use GET for the ANY method, use petstore/pets in place of the proxy resource path ({proxy}), and type=fish for the query string.

    Because the backend website supports the GET /petstore/pets?type=fish request, it will return a successful response similar to the following:

    [ { "id": 1, "type": "fish", "price": 249.99 }, { "id": 2, "type": "fish", "price": 124.99 }, { "id": 3, "type": "fish", "price": 0.99 } ]

    If you try to call GET /petstore, you will get a 404 response with an error message of Cannot GET /petstore. This is because the backend does not support the specified operation. On the other, if you call GET /petstore/pets/1, you will get a 200 OK response with the following payload, because the request is supported by the PetStore website.

    { "id": 1, "type": "dog", "price": 249.99 }
  2. To use a browser to call a GET method on a specific resource of the API, do the following.

    1. If you have not done so, choose Deploy API from the Actions drop-down menu for the API you created. Follow the instructions to deploy the API to a specific stage. Note the Invoke URL that displays on the resulting Stage Editor page. This is the base URL of the API.

    2. To submit a GET request on a specific resource, append the resource path, including possible query string expressions to the Invoke URL value obtained in the previous step, copy the complete URL into the address bar of a browser, and choose Enter.

    For this tutorial, deploy the API to a test stage, append petstore/pets?type=fish to the API's Invoke URL. This produces a URL of

    The result should be the same as the result that is returned when you use TestInvoke from the API Gateway console.