DisassociateClientVpnTargetNetworkCommand

Disassociates a target network from the specified Client VPN endpoint. When you disassociate the last target network from a Client VPN, the following happens:

  • The route that was automatically added for the VPC is deleted

  • All active client connections are terminated

  • New client connections are disallowed

  • The Client VPN endpoint's status changes to pending-associate

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, DisassociateClientVpnTargetNetworkCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, DisassociateClientVpnTargetNetworkCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // DisassociateClientVpnTargetNetworkRequest
  ClientVpnEndpointId: "STRING_VALUE", // required
  AssociationId: "STRING_VALUE", // required
  DryRun: true || false,
};
const command = new DisassociateClientVpnTargetNetworkCommand(input);
const response = await client.send(command);
// { // DisassociateClientVpnTargetNetworkResult
//   AssociationId: "STRING_VALUE",
//   Status: { // AssociationStatus
//     Code: "associating" || "associated" || "association-failed" || "disassociating" || "disassociated",
//     Message: "STRING_VALUE",
//   },
// };

DisassociateClientVpnTargetNetworkCommand Input

Parameter
Type
Description
AssociationId
Required
string | undefined

The ID of the target network association.

ClientVpnEndpointId
Required
string | undefined

The ID of the Client VPN endpoint from which to disassociate the target network.

DryRun
boolean | undefined

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

DisassociateClientVpnTargetNetworkCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
AssociationId
string | undefined

The ID of the target network association.

Status
AssociationStatus | undefined

The current state of the target network association.

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.