Menu
Amazon API Gateway
Developer Guide

Set up API Gateway Integration Request

The settings of an API method defines the method and describes its behaviors. To create a method, you must specify a resource, including the root (“/”), on which the method is exposed, a method type (GET, POST, etc.), and how it will be integrated with the targeted backend. The method request and response specify the contract with the calling app, stipulating which parameters the API can receive and what the response looks like. The integration request and response specifies how API Gateway interacts with their backend: enforcing secure communications over HTTPS with the backend and translating data formats between the client and backend. The following topics describe how to use the API Gateway console to specify a method settings.

  1. In the Resources pane, choose the method.

  2. In the Method Execution pane, choose Integration Request. For Integration type, choose one of the following:

    • Choose Lambda Function if your API will be communicating with a Lambda function.

    • Choose HTTP Proxy if your API will be communicating with an HTTP endpoint.

    • Choose Show Advanced, AWS Service Proxy if your API will be communicating directly with an AWS service.

    • Choose Mock Integration if your API is not yet final, but you want to generate API responses from API Gateway anyway to unblock dependent teams for testing. If you choose this option, skip the rest of the instructions in this topic and see Configure Mock Integration for a Method.

  3. If you chose Lambda Function, do the following:

    1. For Lambda Region, choose the region identifier that corresponds to the region where you created the Lambda function. For example, if you created the Lambda function in the US East (N. Virginia) region, you would choose us-east-1. For a list of region names and identifiers, see AWS Lambda in the Amazon Web Services General Reference.

    2. For Lambda Function, type the name of the Lambda function, and then choose the function's corresponding ARN.

    3. Choose Save.

  4. If you chose HTTP Proxy, do the following:

    1. For HTTP method, choose the HTTP method type that most closely matches the method in the HTTP proxy.

    2. For Endpoint URL, type the URL of the HTTP proxy you want this method to use.

    3. Choose Save.

  5. If you chose Mock Integration, do the following:

    • Choose Save.

  6. If you chose Show advanced, AWS Service Proxy, do the following:

    1. For AWS Region, choose the AWS region you want this method to use to call the action.

    2. For AWS Service, choose the AWS service you want this method to call.

    3. For HTTP method, choose the HTTP method type that corresponds to the action. For HTTP method type, see the API reference documentation for the AWS service you chose for AWS Service.

    4. For Action, type the action you want to use. For a list of available actions, see the API reference documentation for the AWS service you chose for AWS Service.

    5. For Execution Role, type the ARN of the IAM role the method will use to call the action.

      To create the IAM role, you can adapt the instructions in "To create the Lambda invocation role and its policies" and "To create the Lambda execution role and its policy" in the Create Lambda Functions section of the Build an API to Expose a Lambda Function; and specify an access policy of the following format, with the desired number of action and resource statements:

      Copy
      { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "action-statement" ], "Resource": [ "resource-statement" ] }, ... ] }

      For the action and resource statement syntax, see the documentation for the AWS service you chose for AWS Service.

      For the IAM role's trust relationship, specify the following, which enables API Gateway to take actions on behalf of your AWS account:

      Copy
      { "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": "apigateway.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
    6. If the action you typed for Action provides a custom resource path you want this method to use, for Path Override, type this custom resource path. For the custom resource path, see the API reference documentation for the AWS service you chose for AWS Service.

    7. Choose Save.

  7. Do both of the following:

    • Specify how the method will receive requests from, and send responses to, callers (which API Gateway refers to as the API's method request/response), and how the method will authorize requests by following the instructions in Set up Method Request.

    • Specify how the method will send requests to, and receive responses from, the Lambda function, HTTP proxy, or AWS service proxy (which API Gateway refers to as the API's integration request/response) by following the instructions in Set up Data Mappings between Method and Integration.