How to create a private integration using an internal Application Load Balancer for an Amazon API Gateway HTTP API?

Last updated: 2022-10-28

I want to create a private integration using an internal Application Load Balance for an Amazon API Gateway HTTP API. How can I do this?

Resolution

Follow these instructions to create the Amazon Virtual Private Cloud (Amazon VPC) link, HTTP API, private integration, and deploy the HTTP API.

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.

1.    If you haven't already done so, follow the instructions to create an Application Load Balancer.

2.    Open the API Gateway console, and in the navigation pane choose VPC links.

3.    From VPC Links, choose Create.

(Optional) You can also create a VPC link by using the AWS CLI command create-vpc-link similar to the following:

aws apigatewayv2 create-vpc-link --name MyVpcLink \
    --subnet-ids subnet-aaaa subnet-bbbb \
    --security-group-ids sg1234 sg5678

4.    From Choose a VPC link version, choose VPC link for HTTP APIs.

5.    For Name, enter a name for your VPC link.

6.    Choose the VPC dropdown list, choose a VPC for your Application Load Balancer to connect to.

7. For Subnets, choose your subnets to include in the VPC link.

8.    For Security groups, choose the security groups for the VPC link, and then choose Create.

Create an HTTP API and route

1.    Open the API Gateway console, and then choose Create API.

2.    For HTTP API, choose Build.

3.    For API name, enter a name, and then choose Next.

4.    For Configure routes, choose Next.

5.    For Configure stages, choose Next, and then choose Create.

6.    In the navigation pane, choose Routes, and then choose Create.

7.    For Method, choose ANY.

8.    For path, enter /{proxy+} and choose Create.

Create a private integration and deploy the HTTP API

1.    Open the API Gateway console, and then choose your HTTP API.

2.    In the navigation pane, choose Integrations.

3.    For Integrations, choose Manage integrations, and then choose Create.

4.    For Attach this integration to a route, choose ANY /{proxy+}.

5.    For Integration target, choose Private resource.

6.    For Integration details, choose Select manually.

7.    For Target service, choose ALB/NLB.

8.    For Load balancer, choose your load balancer.

9.    For Listener, choose HTTP 80.

10.    For VPC link, choose your VPC, and then choose Create.

11.    (Skip this step if auto deploy is active) Choose Deploy to deploy your HTTP API.

12.    For Invoke URL, copy the URL and paste it into a new browser window. For example, https://abcdef123.execute-api.us-east-1.amazonaws.com.

The HTTP API URL renders successfully in the browser window.