Creates a traffic mirror session.
Operation description
CreateTrafficMirrorSession is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call ListTrafficMirrorSessions to query the status of the task.
- If the traffic mirror session is in the Creating state, it is being created.
- If the traffic mirror session is in the Created state, it is created.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vpc:CreateTrafficMirrorSession | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TrafficMirrorSessionDescription | string | No | The description of the traffic mirror session. The description must be 1 to 256 characters in length and cannot start with | This is a trafficmirrorsession. |
TrafficMirrorSessionName | string | No | The name of the traffic mirror session. The name must be 1 to 128 characters in length, and cannot start with | test |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that the value is unique among all requests. The client token can contain only ASCII characters. Note
If you do not set this parameter, the system uses RequestId as ClientToken. RequestId might be different for each API request.
| 0c593ea1-3bea-11e9-b96b-88e9fe63**** |
DryRun | boolean | No | Specifies whether to perform a dry run. Valid values:
| false |
TrafficMirrorTargetId | string | Yes | The ID of the traffic mirror destination. You can specify only an elastic network interface (ENI) or a Server Load Balancer (SLB) instance as a traffic mirror destination. | eni-j6c8znm5l1yt4sox**** |
TrafficMirrorTargetType | string | Yes | The type of the traffic mirror destination. Valid values:
| NetworkInterface |
TrafficMirrorFilterId | string | Yes | The ID of the filter. | tmf-j6cmls82xnc86vtpe**** |
VirtualNetworkId | integer | No | The VXLAN network identifier (VNI). Valid values: 0 to 16777215. You can use VNIs to identify mirrored traffic from different sessions at the traffic mirror destination. You can specify a custom VNI or use a random VNI allocated by the system. If you want the system to randomly allocate a VNI, do not enter a value. | 1 |
Priority | integer | Yes | The priority of the traffic mirror session. Valid values: 1 to 32766. A smaller value indicates a higher priority. You cannot specify identical priorities for traffic mirror sessions that are created in the same region by using the same account. | 1 |
Enabled | boolean | No | Specifies whether to enable the traffic mirror session. Valid values:
| false |
PacketLength | integer | No | The maximum transmission unit. Valid values: 64 to 9600. Default value: 1500. | 1500 |
TrafficMirrorSourceIds | array | Yes | The ID of the traffic mirror source. You can specify only an elastic network interface (ENI) as the traffic mirror source. The default value of N is 1, which indicates that you can add only one traffic mirror source to a traffic mirror session. | |
string | Yes | The ID of the traffic mirror source. You can specify only an ENI as the traffic mirror source. The default value of N is 1, which means that you can add only one traffic mirror source to a traffic mirror session. | eni-j6c2fp57q8rr47rp**** | |
RegionId | string | Yes | The ID of the region to which the traffic mirror session belongs. You can call the DescribeRegions operation to query the most recent region list. For more information about regions that support traffic mirroring, see Overview of traffic mirroring. | cn-hongkong |
ResourceGroupId | string | No | The ID of the resource group to which the mirrored traffic belongs. | rg-bp67acfmxazb4ph**** |
Tag | array<object> | No | The tag of the resource. | |
object | No | The tag of the resource. | ||
Key | string | No | The tag key. You can specify at most 20 tag keys. The tag key cannot be an empty string. The tag key can be up to 128 characters in length. It cannot start with | FinanceDept |
Value | string | No | The tag value. You can specify at most 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length. It cannot start with | FinanceJoshua |
Response parameters
Examples
Sample success responses
JSON
format
{
"TrafficMirrorSessionId": "tms-j6ce5di4w7nvigfjz****",
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"ResourceGroupId": "rg-bp67acfmxazb4ph****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | IncorrectBusinessStatus.TrafficMirror | The business status of traffic mirror is incorrect. | Traffic mirroring is in an invalid state. |
400 | OptInRequired.TrafficMirror | You need to subscribe to the traffic mirror service first. | Traffic mirroring is disabled. |
400 | DuplicatedParam.SourceInstanceIds | The parameter of source instance IDs contains duplicate values. | Duplicate values are set for TrafficMirrorSourceIds.N. |
400 | OperationDenied.DuplicateRole | The network interface must not be the source and the target of traffic mirror sessions at the same time. | - |
400 | ResourceNotFound.NetworkInterface | The specified resource of %s is not found. | The error message returned because NetworkInterface is set to an invalid value. |
400 | ResourceNotFound.EcsInstance | The specified resource of ECS instance is not found. | - |
400 | ResourceNotFound.Slb | The specified resource of SLB is not found. | - |
400 | OperationDenied.SlbNotInVpc | The specified SLB is not in any VPC. | - |
400 | ResourceNotFound.TrafficMirrorFilter | The specified resource of traffic mirror filter is not found. | The specified filter does not exist. |
400 | IncorrectStatus.TrafficMirrorFilter | The status of traffic mirror filter is incorrect. | The filter is in an invalid state. |
400 | OperationDenied.EcsNotSupportTrafficMirror | The ECS instance does not support traffic mirroring. | - |
400 | QuotaExceeded.SessionNum | The quota of the number of traffic mirror sessions is exceeded. | The number of traffic mirror sessions has reached the upper limit. |
400 | QuotaExceeded.FilterRelatedSession | The quota of the number of traffic mirror sessions related to one filter is exceeded. | The number of traffic mirror sessions associated with the filter has reached the upper limit. |
400 | QuotaExceeded.SourceNumPerSession | The quota of the number of traffic mirror sources per session is exceeded. | The number of traffic mirror sources associated with a traffic mirror session has reached the upper limit. |
400 | QuotaExceeded.NetworkInterfaceRelatedSession | The quota of the number of traffic mirror sessions related to one network interface is exceeded. | The number of traffic mirror sessions associated with an ENI has reached the upper limit. |
400 | QuotaExceeded.SlbRelatedSession | The quota of the number of traffic mirror sessions related to one SLB is exceeded. | The number of traffic mirror sessions associated with an SLB instance has reached the upper limit. |
400 | UnsupportedRegion | The feature is not supported in current region. | The feature is not supported in the current region. |
400 | InvalidLoadBalancerId.NotFound | The specified resource of load balancer is not found. | The SLB instance does not exist. |
400 | OperationDenied.FreeNetworkInterface | The network interface is not attached to any ECS instance. | The ENI is not associated with an ECS instance. |
400 | OperationDenied.ClassicSLB | The operation is not allowed because of ClassicSLB. | The error message returned because you cannot perform the operation on a CLB instance. |
400 | ResourceNotFound.TargetInstance | The specified target instance for traffic mirroring is not found. | The specified traffic mirror destination does not exist. |
400 | QuotaExceeded.SourceNumPerTarget | The maximum number of traffic mirror sources for a target is exceeded. | The number of traffic mirror sources associated with the image exceeds the upper limit. |
400 | IncorrectStatus.NetworkInterface | The status of network interface is incorrect. | The status of the ENI is invalid. |
400 | OperationFailed.NotSupportBizType | The specified instance type does not support the operation. | The specified instance type does not support the operation. |
400 | IllegalParam.Priority | The specified Priority is illegal or the same as other mirroring sessions. | The specified Priority is illegal or identical to another mirroring session |
400 | OperationDenied.UnsupportedTargetType | Traffic mirror target must be SLB if traffic mirror sources contain nat gateway network interface. | When a NAT gateway NIC exists in the traffic mirroring source, the traffic mirroring purpose must be SLB type. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-09-11 | The Error code has changed | View Change Details |
2024-01-15 | The Error code has changed | View Change Details |
2023-09-26 | The Error code has changed | View Change Details |
2023-09-21 | The Error code has changed | View Change Details |
2023-09-14 | The Error code has changed | View Change Details |
2023-08-30 | The Error code has changed | View Change Details |
2023-07-10 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-06-25 | The Error code has changed | View Change Details |
2023-04-14 | The Error code has changed | View Change Details |
2023-03-16 | The Error code has changed | View Change Details |