class VPNGatewayV2 (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ec2.Alpha.VPNGatewayV2 |
Go | github.com/aws/aws-cdk-go/awsec2alpha/v2#VPNGatewayV2 |
Java | software.amazon.awscdk.services.ec2.alpha.VPNGatewayV2 |
Python | aws_cdk.aws_ec2_alpha.VPNGatewayV2 |
TypeScript (source) | @aws-cdk/aws-ec2-alpha ยป VPNGatewayV2 |
Implements
IConstruct
, IDependable
, IResource
, IRoute
Creates a virtual private gateway.
Example
const stack = new Stack();
const myVpc = new VpcV2(this, 'Vpc');
const vpnGateway = myVpc.enableVpnGatewayV2({
vpnRoutePropagation: [{ subnetType: SubnetType.PUBLIC }],
type: VpnConnectionType.IPSEC_1,
});
const routeTable = new RouteTable(stack, 'routeTable', {
vpc: myVpc
} );
new Route(stack, 'route', {
destination: '172.31.0.0/24',
target: { gateway: vpnGateway },
routeTable: routeTable,
});
Initializer
new VPNGatewayV2(scope: Construct, id: string, props: VPNGatewayV2Props)
Parameters
- scope
Construct
- id
string
- props
VPNGateway
V2 Props
Construct Props
Name | Type | Description |
---|---|---|
type | Vpn | The type of VPN connection the virtual private gateway supports. |
vpc | IVpc | The ID of the VPC for which to create the VPN gateway. |
amazon | number | The private Autonomous System Number (ASN) for the Amazon side of a BGP session. |
vpn | string | The resource name of the VPN gateway. |
vpn | Subnet [] | Subnets where the route propagation should be added. |
type
Type:
Vpn
The type of VPN connection the virtual private gateway supports.
vpc
Type:
IVpc
The ID of the VPC for which to create the VPN gateway.
amazonSideAsn?
Type:
number
(optional, default: no ASN set for BGP session)
The private Autonomous System Number (ASN) for the Amazon side of a BGP session.
vpnGatewayName?
Type:
string
(optional, default: resource provisioned without any name)
The resource name of the VPN gateway.
vpnRoutePropagation?
Type:
Subnet
[]
(optional, default: no propogation for routes)
Subnets where the route propagation should be added.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
resource | Cfn | The VPN gateway CFN resource. |
router | string | The ID of the route target. |
router | Router | The type of router used in the route. |
stack | Stack | The stack in which this resource is defined. |
vpc | string | The ID of the VPC for which to create the VPN gateway. |
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:
Node
The tree node.
resource
Type:
Cfn
The VPN gateway CFN resource.
routerTargetId
Type:
string
The ID of the route target.
routerType
Type:
Router
The type of router used in the route.
stack
Type:
Stack
The stack in which this resource is defined.
vpcId
Type:
string
The ID of the VPC for which to create the VPN gateway.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
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.