class VpcLink (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGatewayv2.VpcLink |
Java | software.amazon.awscdk.services.apigatewayv2.VpcLink |
Python | aws_cdk.aws_apigatewayv2.VpcLink |
TypeScript (source) | @aws-cdk/aws-apigatewayv2 » VpcLink |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IVpc
Define a new VPC Link Specifies an API Gateway VPC link for a HTTP API to access resources in an Amazon Virtual Private Cloud (VPC).
Example
import * as ec2 from '@aws-cdk/aws-ec2';
const vpc = new ec2.Vpc(this, 'VPC');
const vpcLink = new apigwv2.VpcLink(this, 'VpcLink', { vpc });
Initializer
new VpcLink(scope: Construct, id: string, props: VpcLinkProps)
Parameters
- scope
Construct
- id
string
- props
Vpc
Link Props
Construct Props
Name | Type | Description |
---|---|---|
vpc | IVpc | The VPC in which the private resources reside. |
security | ISecurity [] | A list of security groups for the VPC link. |
subnets? | Subnet | A list of subnets for the VPC link. |
vpc | string | The name used to label and identify the VPC link. |
vpc
Type:
IVpc
The VPC in which the private resources reside.
securityGroups?
Type:
ISecurity
[]
(optional, default: no security groups. Use addSecurityGroups
to add security groups)
A list of security groups for the VPC link.
subnets?
Type:
Subnet
(optional, default: private subnets of the provided VPC. Use addSubnets
to add more subnets)
A list of subnets for the VPC link.
vpcLinkName?
Type:
string
(optional, default: automatically generated name)
The name used to label and identify the VPC link.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
vpc | IVpc | The VPC to which this VPC Link is associated with. |
vpc | string | Physical ID of the VpcLink resource. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
vpc
Type:
IVpc
The VPC to which this VPC Link is associated with.
vpcLinkId
Type:
string
Physical ID of the VpcLink resource.
Methods
Name | Description |
---|---|
add | Adds the provided security groups to the vpc link. |
add | Adds the provided subnets to the vpc link. |
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import a VPC Link by specifying its attributes. |
SecurityGroups(...groups)
addpublic addSecurityGroups(...groups: ISecurityGroup[]): void
Parameters
- groups
ISecurity
Group
Adds the provided security groups to the vpc link.
Subnets(...subnets)
addpublic addSubnets(...subnets: ISubnet[]): void
Parameters
- subnets
ISubnet
Adds the provided subnets to the vpc link.
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
VpcLinkAttributes(scope, id, attrs)
static frompublic static fromVpcLinkAttributes(scope: Construct, id: string, attrs: VpcLinkAttributes): IVpcLink
Parameters
- scope
Construct
- id
string
- attrs
Vpc
Link Attributes
Returns
Import a VPC Link by specifying its attributes.