Creates a traffic mirror session.
Operation description
CreateTrafficMirrorSession 接口属于异步接口,即系统返回一个实例 ID,但该镜像会话尚未创建成功,系统后台的创建任务仍在进行。您可以调用 ListTrafficMirrorSessions 查询镜像会话的创建状态:
-
当镜像会话处于 Creating 状态时,表示镜像会话正在创建中。
-
当镜像会话处于 Created 状态时,表示镜像会话创建完成。
Try it now
Test
RAM authorization
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 used to ensure the idempotence of the request. You can use the client to generate the token value, but you must ensure it 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 |
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. VNIs identify mirrored traffic from different sessions at the traffic mirror destination. Specify a custom VNI or leave this parameter empty to let the system allocate one randomly. |
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 in the same region under the same account. |
1 |
| Enabled |
boolean |
No |
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. |
eni-j6c2fp57q8rr47rp**** |
|
string |
No |
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 region ID of the traffic mirror session. 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 mirror. |
cn-hongkong |
| ResourceGroupId |
string |
No |
The resource group ID of the mirrored traffic. |
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 elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| TrafficMirrorSessionId |
string |
The ID of the traffic mirror session. |
tms-j6ce5di4w7nvigfjz**** |
| RequestId |
string |
The ID of the request. |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
| ResourceGroupId |
string |
The resource group ID of the mirrored traffic. |
rg-bp67acfmxazb4ph**** |
Examples
Success response
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. |
| 400 | OperationDenied.TargetTypeNotSupportGatewayLoadBalancerEndpoint | Operation denied because of target type can not be GatewayLoadBalancerEndpoint. | Gateway-based load balancing endpoints are not supported as traffic mirrors mu d |
| 400 | OperationDenied.TargetTypeNotSupportBondEni | Operation denied because of target type can not be Bond Network Interface. | Operation denied because of target type can not be Bond Network Interface. |
| 400 | OperationDenied.InvalidTargetBondEniType | The traffic mirroring target does not support the entered bond ENI type. | The traffic mirroring target does not support the entered bond ENI type. |
| 400 | OperationDenied.InvalidSourceBondEniType | The traffic mirroring source does not support the entered bond ENI type. | The traffic mirroring source does not support the entered bond ENI type. |
| 400 | OperationDenied.TargetTypeNotSupportTrafficMirrorFullPacket | The traffic mirror session target type does not support the feature of mirroring source full packet. | The traffic mirror session target type does not support the feature of mirroring source full packet |
| 400 | OperationDenied.TrafficMirrorSessionSourceFullPacketNotSupport | The traffic mirror session does not support the feature of mirroring source full packet. | Traffic mirror currently does not support source full packet mirroring. TrafficMirrorSourceTruncateMode can only be set to 0, which is the default mode. |
| 400 | QuotaExceeded.SessionNumPerTarget | The quota of the number of traffic mirror sessions per target is exceeded. | |
| 400 | OperationDenied.NotSupportBondEniAsTrafficMirrorSource | The operation is not allowed because bond eni cannot be the source of traffic mirror. | Bond eni is not allowed to be the source of traffic mirror. |
| 400 | IncorrectStatus.TrafficMirrorSessionTarget | The status of the target of the traffic mirror session is incorrect. | The status of the intent of the traffic mirroring session is incorrect. |
| 404 | ResourceNotFound.GatewayLoadBalancerEndpoint | GatewayLoadBalancerEndpoint instance not found. | GatewayLoadBalancerEndpoint instance not found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.