AWS API Gateway V2 VPC Link
This page shows how to write Terraform and CloudFormation for API Gateway V2 VPC Link and write them securely.
aws_apigatewayv2_vpc_link (Terraform)
The VPC Link in API Gateway V2 can be configured in Terraform with the resource name aws_apigatewayv2_vpc_link
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_apigatewayv2_vpc_link" "main" {
name = "alb-private-link"
security_group_ids = [var.vpc_link_sg_ids]
subnet_ids = var.private_subnets
resource "aws_apigatewayv2_vpc_link" "vpilink" {
name = var.vpc_link_name
security_group_ids = [aws_security_group.vpclink.id]
subnet_ids = var.subnet_private_ids
tags = {
resource "aws_apigatewayv2_vpc_link" "this" {
name = var.name
security_group_ids = var.security_group_ids
subnet_ids = var.subnet_ids
tags = var.tags
}
resource "aws_apigatewayv2_vpc_link" "vpclink" {
name = "neocar_vpclink"
security_group_ids = [var.LBSecurityGroup]
subnet_ids = var.VPCSubnets
}
Parameters
-
arn
optional computed - string -
id
optional computed - string -
name
required - string -
security_group_ids
required - set of string -
subnet_ids
required - set of string -
tags
optional - map from string to string
Explanation in Terraform Registry
Manages an Amazon API Gateway Version 2 VPC Link. -> Note: Amazon API Gateway Version 2 VPC Links enable private integrations that connect HTTP APIs to private resources in a VPC. To enable private integration for REST APIs, use the Amazon API Gateway Version 1 VPC Link resource.
AWS::ApiGatewayV2::VpcLink (CloudFormation)
The VpcLink in ApiGatewayV2 can be configured in CloudFormation with the resource name AWS::ApiGatewayV2::VpcLink
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
-
SubnetIds
required - List -
SecurityGroupIds
optional - List -
Tags
optional - Json -
Name
required - String
Explanation in CloudFormation Registry
The
AWS::ApiGatewayV2::VpcLink
resource creates a VPC link. Supported only for HTTP APIs. The VPC link status must transition fromPENDING
toAVAILABLE
to successfully create a VPC link, which can take up to 10 minutes. To learn more, see Working with VPC Links for HTTP APIs in the API Gateway Developer Guide.
Frequently asked questions
What is AWS API Gateway V2 VPC Link?
AWS API Gateway V2 VPC Link is a resource for API Gateway V2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS API Gateway V2 VPC Link?
For Terraform, the Piroddi/aws-http-api-private-alb, nekochans/kimono-app-terraform and niveklabs/aws source code examples are useful. See the Terraform Example section for further details.