

# AssociateTrunkInterface
<a name="API_AssociateTrunkInterface"></a>

Associates a branch network interface with a trunk network interface.

Before you create the association, use [CreateNetworkInterface](https://docs.amazonaws.cn/AWSEC2/latest/APIReference/API_CreateNetworkInterface.html) command and set the interface type to `trunk`. You must also create a network interface for each branch network interface that you want to associate with the trunk network interface.

## Request Parameters
<a name="API_AssociateTrunkInterface_RequestParameters"></a>

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see [Common Query Parameters](CommonParameters.md).

 **BranchInterfaceId**   
The ID of the branch network interface.  
Type: String  
Required: Yes

 **ClientToken**   
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see [Ensuring idempotency](https://docs.amazonaws.cn/ec2/latest/devguide/ec2-api-idempotency.html).  
Type: String  
Required: No

 **DryRun**   
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`.  
Type: Boolean  
Required: No

 **GreKey**   
The application key. This applies to the GRE protocol.  
Type: Integer  
Required: No

 **TrunkInterfaceId**   
The ID of the trunk network interface.  
Type: String  
Required: Yes

 **VlanId**   
The ID of the VLAN. This applies to the VLAN protocol.  
Type: Integer  
Required: No

## Response Elements
<a name="API_AssociateTrunkInterface_ResponseElements"></a>

The following elements are returned by the service.

 **clientToken**   
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see [Ensuring idempotency](https://docs.amazonaws.cn/ec2/latest/devguide/ec2-api-idempotency.html).  
Type: String

 **interfaceAssociation**   
Information about the association between the trunk network interface and branch network interface.  
Type: [TrunkInterfaceAssociation](API_TrunkInterfaceAssociation.md) object

 **requestId**   
The ID of the request.  
Type: String

## Errors
<a name="API_AssociateTrunkInterface_Errors"></a>

For information about the errors that are common to all actions, see [Common client error codes](errors-overview.md#CommonErrors).

## See Also
<a name="API_AssociateTrunkInterface_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/ec2-2016-11-15/AssociateTrunkInterface) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/ec2-2016-11-15/AssociateTrunkInterface) 