AddSourcesToTrafficMirrorSession

更新时间: 2026-06-19 05:38:42

Adds traffic mirror sources to a traffic mirror session by calling the AddSourcesToTrafficMirrorSession operation.

Operation description

  • AddSourcesToTrafficMirrorSession is an asynchronous operation. After a request is sent, the system returns a request ID. However, the traffic mirror source is not yet added, and the addition task is still running in the background. You can call ListTrafficMirrorSessions to query the status of the traffic mirror source addition:
    • If the traffic mirror session is in the Modifying state, the traffic mirror source is being added.

    • If the traffic mirror session is in the Created state, the traffic mirror source is added.

  • AddSourcesToTrafficMirrorSession does not support concurrent requests to add traffic mirror sources to the same traffic mirror session.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vpc:AddSourcesToTrafficMirrorSession

update

*TrafficMirrorSession

acs:vpc:{#regionId}:{#accountId}:trafficmirrorsession/{#TrafficMirrorSessionId}

None None

Request parameters

Parameter

Type

Required

Description

Example

ClientToken

string

No

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The ClientToken value can contain only ASCII characters.

Note

If you do not specify this parameter, the system automatically uses the RequestId value as the ClientToken value. The RequestId value may be different for each API request.

0c593ea1-3bea-11e9-b96b-88e9fe63****

DryRun

boolean

No

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks the required parameters, request syntax, and limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.

  • false (default): performs a dry run and sends the request. If the request passes the dry run, the traffic mirror source is added.

false

TrafficMirrorSessionId

string

Yes

The instance ID of the traffic mirror session to which you want to increase traffic mirror sources.

tms-j6cla50buc44ap8tu****

TrafficMirrorSourceIds

array

Yes

The instance ID of the traffic mirror source to increase. Currently, only elastic network interfaces (ENIs) are supported as traffic mirror sources. The default value of N is 1, which indicates that you can add only one traffic mirror source to a traffic mirror session.

eni-j6ccmrl8z3xkvxgw****

string

No

The instance ID of the traffic mirror source to increase. Currently, only elastic network interfaces (ENIs) are supported as traffic mirror sources. The default value of N is 1, which indicates that you can add only one traffic mirror source to a traffic mirror session.

eni-j6c8znm5l1yt4sox****

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 the regions that support traffic mirroring, see Traffic mirroring overview.

cn-hongkong

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

87F70089-5B38-41A8-BAD8-0B55E2F8DC57

Examples

Success response

JSON format

{
  "RequestId": "87F70089-5B38-41A8-BAD8-0B55E2F8DC57"
}

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 ResourceNotFound.TrafficMirrorSession The specified resource of traffic mirror session is not found.
400 IncorrectStatus.TrafficMirrorSession The status of traffic mirror session is incorrect.
400 ResourceAlreadyAssociated.TrafficMirrorSource The specified traffic mirror source and session are already associated.
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 OperationDenied.EcsNotSupportTrafficMirror The ECS instance does not support traffic mirroring.
400 OperationDenied.DuplicateRole The network interface must not be the source and the target of traffic mirror sessions at the same time.
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 OperationDenied.FreeNetworkInterface The network interface is not attached to any ECS instance. The ENI is not associated with an ECS instance.
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.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 OperationUnsupported.BondingNetworkInterface The specified traffic mirror source is bonding eni without slave. The operation does not support a bond ENI without a slave ENI.
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.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.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.

上一篇: Session 下一篇: Route Target Group
阿里云首页 专有网络VPC 相关技术圈