ClientVpnEndpoint L2 construct
A client VPN connection.
Example
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',
});
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"
)
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());
// 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"
});
// 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
new ClientVpnEndpoint(scope: Construct, id: string, props: ClientVpnEndpointProps)
ClientVpnEndpoint(scope: Construct, id: str, props: ClientVpnEndpointProps)
new ClientVpnEndpoint(Construct scope, String id, ClientVpnEndpointProps props)
new ClientVpnEndpoint(Construct scope, string id, ClientVpnEndpointProps props)
NewClientVpnEndpoint(Scope Construct, Id *string, Props ClientVpnEndpointProps)
Construct Props
authorizeAllUsersToVpcCidrbooleanauthorize_all_users_to_vpc_cidrboolauthorizeAllUsersToVpcCidrBooleanAuthorizeAllUsersToVpcCidrboolAuthorizeAllUsersToVpcCidr*bool= true#This automatically creates an authorization rule. Set this to false and use addAuthorizationRule() to create your own rules instead.
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.
clientCertificateArnstringclient_certificate_arnstrclientCertificateArnStringClientCertificateArnstringClientCertificateArn*string= use user-based authentication#The certificate must be signed by a certificate authority (CA) and it must be provisioned in AWS Certificate Manager (ACM).
clientConnectionHandlerIClientVpnConnectionHandlerclient_connection_handlerIClientVpnConnectionHandlerclientConnectionHandlerIClientVpnConnectionHandlerClientConnectionHandlerIClientVpnConnectionHandlerClientConnectionHandlerIClientVpnConnectionHandler= no connection handler#The name of the Lambda function must begin with the AWSClientVPN- prefix
clientLoginBannerstringclient_login_bannerstrclientLoginBannerStringClientLoginBannerstringClientLoginBanner*string= no banner is presented to the cl…#UTF-8 encoded characters only. Maximum of 1400 characters.
default
Default: no banner is presented to the client
clientRouteEnforcementOptionsClientRouteEnforcementOptionsclient_route_enforcement_optionsClientRouteEnforcementOptionsclientRouteEnforcementOptionsClientRouteEnforcementOptionsClientRouteEnforcementOptionsClientRouteEnforcementOptionsClientRouteEnforcementOptionsClientRouteEnforcementOptions= undefined - AWS Client VPN defau…#notes · default
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.
Default: undefined - AWS Client VPN default setting is disable client route enforcement
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= no description#disconnectOnSessionTimeoutbooleandisconnect_on_session_timeoutbooldisconnectOnSessionTimeoutBooleanDisconnectOnSessionTimeoutboolDisconnectOnSessionTimeout*bool= undefined - AWS Client VPN defau…#If true, users are prompted to reconnect client VPN. If false, client VPN attempts to reconnect automatically.
default
Default: undefined - AWS Client VPN default is true
dnsServersstring[]dns_serverstyping.List[str]dnsServersList<String>DnsServersstring[]DnsServers*[]*string= use the DNS address configured o…#A Client VPN endpoint can have up to two DNS servers.
default
Default: use the DNS address configured on the device
logGroupILogGroupReflog_groupILogGroupReflogGroupILogGroupRefLogGroupILogGroupRefLogGroupILogGroupRef= a new group is created#logStreamILogStreamReflog_streamILogStreamReflogStreamILogStreamRefLogStreamILogStreamRefLogStreamILogStreamRef= a new stream is created#securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= a new security group is created#selfServicePortalbooleanself_service_portalboolselfServicePortalBooleanSelfServicePortalboolSelfServicePortal*bool= true#serverCertificateArnstringserver_certificate_arnstrserverCertificateArnStringServerCertificateArnstringServerCertificateArn*stringrequired#sessionTimeoutClientVpnSessionTimeoutsession_timeoutClientVpnSessionTimeoutsessionTimeoutClientVpnSessionTimeoutSessionTimeoutClientVpnSessionTimeoutSessionTimeoutClientVpnSessionTimeout= ClientVpnSessionTimeout.TWENTY_F…#default
Default: ClientVpnSessionTimeout.TWENTY_FOUR_HOURS
transportProtocolTransportProtocoltransport_protocolTransportProtocoltransportProtocolTransportProtocolTransportProtocolTransportProtocolTransportProtocolTransportProtocol= TransportProtocol.UDP#userBasedAuthenticationClientVpnUserBasedAuthenticationuser_based_authenticationClientVpnUserBasedAuthenticationuserBasedAuthenticationClientVpnUserBasedAuthenticationUserBasedAuthenticationClientVpnUserBasedAuthenticationUserBasedAuthenticationClientVpnUserBasedAuthentication= use mutual authentication#vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection= the VPC default strategy#Properties
clientVpnEndpointRefClientVpnEndpointReferenceclient_vpn_endpoint_refClientVpnEndpointReferenceclientVpnEndpointRefClientVpnEndpointReferenceClientVpnEndpointRefClientVpnEndpointReferenceClientVpnEndpointRefClientVpnEndpointReferencerequired#connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#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.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#targetNetworksAssociatedIDependabletarget_networks_associatedIDependabletargetNetworksAssociatedIDependableTargetNetworksAssociatedIDependableTargetNetworksAssociatedIDependablerequired#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#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#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)#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)#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#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#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#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#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#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.