I want to create a private integration with an internal Application Load Balancer for an Amazon API Gateway HTTP API.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.
To create a private integration with an internal Application Load Balancer for an API Gateway HTTP API, complete the following steps:
- Create an Amazon Virtual Private Cloud (Amazon VPC) link.
- Create an HTTP API and route.
- Create a private integration.
- Deploy the HTTP API.
Create the VPC link
Prerequisite: Create an Application Load Balancer.
Complete the following steps:
-
Open the API Gateway console.
-
In the navigation pane, choose VPC links.
-
From VPC Links, choose Create.
Or, create a VPC link from the AWS CLI with the create-vpc-link command:
aws apigatewayv2 create-vpc-link --name MyVpcLink \
--subnet-ids subnet-aaaa subnet-bbbb \
--security-group-ids sg1234 sg5678
-
From Choose a VPC link version, choose VPC link for HTTP APIs.
-
For Name, enter a name for your VPC link.
-
From the VPC dropdown list, choose a VPC for your Application Load Balancer to connect to.
-
For Subnets, choose your subnets to include in the VPC link.
-
For Security groups, choose the security groups for the VPC link, and then choose Create.
Create an HTTP API and route
Complete the following steps:
- Open the API Gateway console.
- Choose Create API.
- For HTTP API, choose Build.
- For API name, enter a name, and then choose Next.
- For Configure routes, choose Next.
- For Configure stages, choose Next, and then choose Create.
- In the navigation pane, choose Routes, and then choose Create.
- For Method, choose ANY.
- For path, enter /{proxy+} and then choose Create.
Create a private integration and deploy the HTTP API
Complete the following steps:
- Open the API Gateway console.
- Choose your HTTP API.
- In the navigation pane, choose Integrations.
- For Integrations, choose Manage integrations, and then choose Create.
- For Attach this integration to a route, choose ANY /{proxy+}.
- For Integration target, choose Private resource.
- For Integration details, choose Select manually.
- For Target service, choose ALB/NLB.
- For Load balancer, choose the Application Load Balancer that you already created.
- For Listener, choose HTTP 80.
- For VPC link, choose your VPC, and then choose Create.
- (Skip this step if auto deploy is active) Choose Deploy to deploy your HTTP API.
- 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.
Related information
Amazon API Gateway HTTP API tutorials
How do I map the response status codes for API Gateway integrations in HTTP APIs?