Skip to content
v2.274.0

ClientVpnEndpoint L2 construct ​

A client VPN connection.

Example ​

ts
const endpoint = vpc.addClientVpnEndpoint('Endpoint', {
  cidr: '10.100.0.0/16',
  serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id',
  userBasedAuthentication: ec2.ClientVpnUserBasedAuthentication.federated(samlProvider),
  authorizeAllUsersToVpcCidr: false,
});

endpoint.addAuthorizationRule('Rule', {
  cidr: '10.0.10.0/32',
  groupId: 'group-id',
});
python
endpoint = vpc.add_client_vpn_endpoint("Endpoint",
    cidr="10.100.0.0/16",
    server_certificate_arn="arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id",
    user_based_authentication=ec2.ClientVpnUserBasedAuthentication.federated(saml_provider),
    authorize_all_users_to_vpc_cidr=False
)

endpoint.add_authorization_rule("Rule",
    cidr="10.0.10.0/32",
    group_id="group-id"
)
java
ClientVpnEndpoint endpoint = vpc.addClientVpnEndpoint("Endpoint", ClientVpnEndpointOptions.builder()
        .cidr("10.100.0.0/16")
        .serverCertificateArn("arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id")
        .userBasedAuthentication(ClientVpnUserBasedAuthentication.federated(samlProvider))
        .authorizeAllUsersToVpcCidr(false)
        .build());

endpoint.addAuthorizationRule("Rule", ClientVpnAuthorizationRuleOptions.builder()
        .cidr("10.0.10.0/32")
        .groupId("group-id")
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var endpoint = vpc.AddClientVpnEndpoint("Endpoint", new ClientVpnEndpointOptions {
    Cidr = "10.100.0.0/16",
    ServerCertificateArn = "arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id",
    UserBasedAuthentication = ClientVpnUserBasedAuthentication.Federated(samlProvider),
    AuthorizeAllUsersToVpcCidr = false
});

endpoint.AddAuthorizationRule("Rule", new ClientVpnAuthorizationRuleOptions {
    Cidr = "10.0.10.0/32",
    GroupId = "group-id"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
endpoint := vpc.addClientVpnEndpoint(jsii.String("Endpoint"), &ClientVpnEndpointOptions{
	Cidr: jsii.String("10.100.0.0/16"),
	ServerCertificateArn: jsii.String("arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id"),
	UserBasedAuthentication: ec2.ClientVpnUserBasedAuthentication_Federated(samlProvider),
	AuthorizeAllUsersToVpcCidr: jsii.Boolean(false),
})

endpoint.AddAuthorizationRule(jsii.String("Rule"), &ClientVpnAuthorizationRuleOptions{
	Cidr: jsii.String("10.0.10.0/32"),
	GroupId: jsii.String("group-id"),
})

Initializer ​

ts
new ClientVpnEndpoint(scope: Construct, id: string, props: ClientVpnEndpointProps)
python
ClientVpnEndpoint(scope: Construct, id: str, props: ClientVpnEndpointProps)
java
new ClientVpnEndpoint(Construct scope, String id, ClientVpnEndpointProps props)
csharp
new ClientVpnEndpoint(Construct scope, string id, ClientVpnEndpointProps props)
go
NewClientVpnEndpoint(Scope Construct, Id *string, Props ClientVpnEndpointProps)

Construct Props ​

authorizeAllUsersToVpcCidroptionalbooleanauthorize_all_users_to_vpc_cidroptionalboolauthorizeAllUsersToVpcCidroptionalBooleanAuthorizeAllUsersToVpcCidroptionalboolAuthorizeAllUsersToVpcCidroptional*bool= true#
Whether to authorize all users to the VPC CIDR.

This automatically creates an authorization rule. Set this to false and use addAuthorizationRule() to create your own rules instead.

cidrstringcidrstrcidrStringCidrstringCidr*stringrequired#
The IPv4 address range, in CIDR notation, from which to assign client IP addresses.
notes

The address range cannot overlap with the local CIDR of the VPC in which the associated subnet is located, or the routes that you add manually.

Changing the address range will replace the Client VPN endpoint.

The CIDR block should be /22 or greater.

clientCertificateArnoptionalstringclient_certificate_arnoptionalstrclientCertificateArnoptionalStringClientCertificateArnoptionalstringClientCertificateArnoptional*string#
The ARN of the client certificate for mutual authentication.

Default: use user-based authentication

The certificate must be signed by a certificate authority (CA) and it must be provisioned in AWS Certificate Manager (ACM).

clientConnectionHandleroptionalIClientVpnConnectionHandlerclient_connection_handleroptionalIClientVpnConnectionHandlerclientConnectionHandleroptionalIClientVpnConnectionHandlerClientConnectionHandleroptionalIClientVpnConnectionHandlerClientConnectionHandleroptionalIClientVpnConnectionHandler#
The AWS Lambda function used for connection authorization.

Default: no connection handler

The name of the Lambda function must begin with the AWSClientVPN- prefix

clientLoginBanneroptionalstringclient_login_banneroptionalstrclientLoginBanneroptionalStringClientLoginBanneroptionalstringClientLoginBanneroptional*string#
Customizable text that will be displayed in a banner on AWS provided clients when a VPN session is established.

Default: no banner is presented to the client

UTF-8 encoded characters only. Maximum of 1400 characters.

clientRouteEnforcementOptionsoptionalClientRouteEnforcementOptionsclient_route_enforcement_optionsoptionalClientRouteEnforcementOptionsclientRouteEnforcementOptionsoptionalClientRouteEnforcementOptionsClientRouteEnforcementOptionsoptionalClientRouteEnforcementOptionsClientRouteEnforcementOptionsoptionalClientRouteEnforcementOptions#
Options for Client Route Enforcement.

Default: undefined - AWS Client VPN default setting is disable client route enforcement

notes

Client Route Enforcement is a feature of Client VPN that helps enforce administrator defined routes on devices connected through the VPN. This feature helps improve your security posture by ensuring that network traffic originating from a connected client is not inadvertently sent outside the VPN tunnel.

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
A brief description of the Client VPN endpoint.

Default: no description

disconnectOnSessionTimeoutoptionalbooleandisconnect_on_session_timeoutoptionalbooldisconnectOnSessionTimeoutoptionalBooleanDisconnectOnSessionTimeoutoptionalboolDisconnectOnSessionTimeoutoptional*bool#
Indicates whether the client VPN session is disconnected after the maximum `sessionTimeout` is reached.

Default: undefined - AWS Client VPN default is true

If true, users are prompted to reconnect client VPN. If false, client VPN attempts to reconnect automatically.

dnsServersoptionalstring[]dns_serversoptionaltyping.List[str]dnsServersoptionalList<String>DnsServersoptionalstring[]DnsServersoptional*[]*string#
Information about the DNS servers to be used for DNS resolution.

Default: use the DNS address configured on the device

A Client VPN endpoint can have up to two DNS servers.

loggingoptionalbooleanloggingoptionalboolloggingoptionalBooleanLoggingoptionalboolLoggingoptional*bool= true#
Whether to enable connections logging.
logGroupoptionalILogGroupReflog_groupoptionalILogGroupReflogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRef#
A CloudWatch Logs log group for connection logging.

Default: a new group is created

logStreamoptionalILogStreamReflog_streamoptionalILogStreamReflogStreamoptionalILogStreamRefLogStreamoptionalILogStreamRefLogStreamoptionalILogStreamRef#
A CloudWatch Logs log stream for connection logging.

Default: a new stream is created

portoptionalVpnPortportoptionalVpnPortportoptionalVpnPortPortoptionalVpnPortPortoptionalVpnPort= VpnPort.HTTPS#
The port number to assign to the Client VPN endpoint for TCP and UDP traffic.
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup#
The security groups to apply to the target network.

Default: a new security group is created

selfServicePortaloptionalbooleanself_service_portaloptionalboolselfServicePortaloptionalBooleanSelfServicePortaloptionalboolSelfServicePortaloptional*bool= true#
Specify whether to enable the self-service portal for the Client VPN endpoint.
serverCertificateArnstringserver_certificate_arnstrserverCertificateArnStringServerCertificateArnstringServerCertificateArn*stringrequired#
The ARN of the server certificate.
sessionTimeoutoptionalClientVpnSessionTimeoutsession_timeoutoptionalClientVpnSessionTimeoutsessionTimeoutoptionalClientVpnSessionTimeoutSessionTimeoutoptionalClientVpnSessionTimeoutSessionTimeoutoptionalClientVpnSessionTimeout#
The maximum VPN session duration time.

Default: ClientVpnSessionTimeout.TWENTY_FOUR_HOURS

splitTunneloptionalbooleansplit_tunneloptionalboolsplitTunneloptionalBooleanSplitTunneloptionalboolSplitTunneloptional*bool= false#
Indicates whether split-tunnel is enabled on the AWS Client VPN endpoint.
transportProtocoloptionalTransportProtocoltransport_protocoloptionalTransportProtocoltransportProtocoloptionalTransportProtocolTransportProtocoloptionalTransportProtocolTransportProtocoloptionalTransportProtocol= TransportProtocol.UDP#
The transport protocol to be used by the VPN session.
userBasedAuthenticationoptionalClientVpnUserBasedAuthenticationuser_based_authenticationoptionalClientVpnUserBasedAuthenticationuserBasedAuthenticationoptionalClientVpnUserBasedAuthenticationUserBasedAuthenticationoptionalClientVpnUserBasedAuthenticationUserBasedAuthenticationoptionalClientVpnUserBasedAuthentication#
The type of user-based authentication to use.

Default: use mutual authentication

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC to connect to.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection#
Subnets to associate to the client VPN endpoint.

Default: the VPC default strategy

Properties ​

clientVpnEndpointRefClientVpnEndpointReferenceclient_vpn_endpoint_refClientVpnEndpointReferenceclientVpnEndpointRefClientVpnEndpointReferenceClientVpnEndpointRefClientVpnEndpointReferenceClientVpnEndpointRefClientVpnEndpointReferencerequired#
A reference to a ClientVpnEndpoint resource.
connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#
Allows specify security group connections for the endpoint.
endpointIdstringendpoint_idstrendpointIdStringEndpointIdstringEndpointId*stringrequired#
The endpoint ID.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
targetNetworksAssociatedIDependabletarget_networks_associatedIDependabletargetNetworksAssociatedIDependableTargetNetworksAssociatedIDependableTargetNetworksAssociatedIDependablerequired#
Dependable that can be depended upon to force target networks associations.

Methods ​

addAuthorizationRule(id: string, props: ClientVpnAuthorizationRuleOptions): ClientVpnAuthorizationRuledef add_authorization_rule(self, id: str, props: ClientVpnAuthorizationRuleOptions) -> ClientVpnAuthorizationRulepublic ClientVpnAuthorizationRule addAuthorizationRule(String id, ClientVpnAuthorizationRuleOptions props)public ClientVpnAuthorizationRule AddAuthorizationRule(string id, ClientVpnAuthorizationRuleOptions props)func AddAuthorizationRule(Id *string, Props ClientVpnAuthorizationRuleOptions) ClientVpnAuthorizationRule#
Adds an authorization rule to this endpoint.
addRoute(id: string, props: ClientVpnRouteOptions): ClientVpnRoutedef add_route(self, id: str, props: ClientVpnRouteOptions) -> ClientVpnRoutepublic ClientVpnRoute addRoute(String id, ClientVpnRouteOptions props)public ClientVpnRoute AddRoute(string id, ClientVpnRouteOptions props)func AddRoute(Id *string, Props ClientVpnRouteOptions) ClientVpnRoute#
Adds a route to this endpoint.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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).

fromEndpointAttributes(scope: Construct, id: string, attrs: ClientVpnEndpointAttributes): IClientVpnEndpoint@staticmethod def from_endpoint_attributes(scope: Construct, id: str, attrs: ClientVpnEndpointAttributes) -> IClientVpnEndpointpublic static IClientVpnEndpoint fromEndpointAttributes(Construct scope, String id, ClientVpnEndpointAttributes attrs)public static IClientVpnEndpoint FromEndpointAttributes(Construct scope, string id, ClientVpnEndpointAttributes attrs)func FromEndpointAttributes(Scope Construct, Id *string, Attrs ClientVpnEndpointAttributes) IClientVpnEndpointstatic#
Import an existing client VPN endpoint.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.