AWS::ApiGateway::VpcLink
The AWS::ApiGateway::VpcLink
resource creates an API Gateway VPC link for a REST API to access resources in an Amazon Virtual Private Cloud (VPC). For more information, see vpclink:create in the Amazon API Gateway REST API Reference
.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::ApiGateway::VpcLink", "Properties" : { "Description" :
String
, "Name" :String
, "Tags" :[ Tag, ... ]
, "TargetArns" :[ String, ... ]
} }
YAML
Type: AWS::ApiGateway::VpcLink Properties: Description:
String
Name:String
Tags:- Tag
TargetArns:- String
Properties
Description
-
The description of the VPC link.
Required: No
Type: String
Update requires: No interruption
Name
-
The name used to label and identify the VPC link.
Required: Yes
Type: String
Update requires: No interruption
-
An array of arbitrary tags (key-value pairs) to associate with the VPC link.
Required: No
Type: Array of Tag
Update requires: No interruption
TargetArns
-
The ARN of the network load balancer of the VPC targeted by the VPC link. The network load balancer must be owned by the same AWS account of the API owner.
Required: Yes
Type: Array of String
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the ID of the VpcLink
.
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
The Fn::GetAtt
intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function, see Fn::GetAtt
.
VpcLinkId
-
The ID for the VPC link. For example:
abc123
.
Examples
Create VPC link
JSON
{ "Parameters": { "description": { "Type": "String" }, "name": { "Type": "String" } }, "Resources": { "MyVpcLink": { "Type": "AWS::ApiGateway::VpcLink", "Properties": { "Description": { "Ref": "description" }, "Name": { "Ref": "name" }, "TargetArns": [ { "Ref": "MyLoadBalancer" } ] } }, "MyLoadBalancer": { "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", "Properties": { "Type": "network", "Subnets": [ { "Ref": "MySubnet" } ] } }, "MySubnet": { "Type": "AWS::EC2::Subnet", "Properties": { "VpcId": { "Ref": "MyVPC" }, "CidrBlock": "10.0.0.0/24" } }, "MyVPC": { "Type": "AWS::EC2::VPC", "Properties": { "CidrBlock": "10.0.0.0/16" } }, "MyInternetGateway": { "Type": "AWS::EC2::InternetGateway" }, "MyInternetGatewayAttachment": { "Type": "AWS::EC2::VPCGatewayAttachment", "Properties": { "VpcId": { "Ref": "MyVPC" }, "InternetGatewayId": { "Ref": "MyInternetGateway" } } } } }
YAML
Parameters: description: Type: String name: Type: String Resources: MyVpcLink: Type: AWS::ApiGateway::VpcLink Properties: Description: !Ref description Name: !Ref name TargetArns: - !Ref MyLoadBalancer MyLoadBalancer: Type: AWS::ElasticLoadBalancingV2::LoadBalancer Properties: Type: network Subnets: - !Ref MySubnet MySubnet: Type: AWS::EC2::Subnet Properties: VpcId: !Ref MyVPC CidrBlock: 10.0.0.0/24 MyVPC: Type: AWS::EC2::VPC Properties: CidrBlock: 10.0.0.0/16 MyInternetGateway: Type: AWS::EC2::InternetGateway MyInternetGatewayAttachment: Type: AWS::EC2::VPCGatewayAttachment Properties: VpcId: !Ref MyVPC InternetGatewayId: !Ref MyInternetGateway
See also
-
vpclink:create in the Amazon API Gateway REST API Reference