Calls the CreateTrafficMirrorFilter operation to create a traffic mirror filter.
Operation description
The CreateTrafficMirrorFilter operation is an asynchronous operation. After you send the request, the system returns an instance ID but the traffic mirror filter is not yet created. The creation task is still running in the background. You can call ListTrafficMirrorFilters to query the status of the traffic mirror filter:
If the traffic mirror filter is in the Creating state, the traffic mirror filter is being created.
If the traffic mirror filter is in the Created state, the traffic mirror filter is created.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:CreateTrafficMirrorFilter |
create |
*TrafficMirrorFilter
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| TrafficMirrorFilterDescription |
string |
No |
The description of the traffic mirror filter. The description must be 1 to 256 characters in length and cannot start with |
this is a filter. |
| TrafficMirrorFilterName |
string |
No |
The name of the traffic mirror filter. The name must be 1 to 128 characters in length and cannot start with |
abc |
| 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 uses the value of RequestId as the value of ClientToken. The value of RequestId is different for each API request. |
123e4567-e89b-12d3-a456-426655440000 |
| DryRun |
boolean |
No |
Specifies whether to perform only a dry run, without performing the actual request. Valid values:
|
false |
| IngressRules |
array<object> |
No |
The information about the inbound rules. |
|
|
object |
No |
The information about the inbound rules. |
||
| Action |
string |
Yes |
The collection policy of the inbound rule. Valid values:
|
accept |
| SourceCidrBlock |
string |
No |
The source CIDR block of the inbound rule. |
10.0.0.0/24 |
| Protocol |
string |
Yes |
The protocol type of the network traffic to be mirrored for the inbound rule. Valid values:
|
TCP |
| IpVersion |
string |
Yes |
The IP version of the instance. Valid values:
|
IPv4 |
| DestinationPortRange |
string |
No |
The destination port range of the inbound rule. Valid values for port numbers: 1 to 65535. Separate the start port and end port with a forward slash (/). Format: 1/200 or 80/80. Note
If IngressRules.N.Protocol is set to ALL or ICMP, this parameter does not need to be set, which indicates that all ports are available. |
80/120 |
| Priority |
integer |
No |
The priority of the inbound rule. A smaller value indicates a higher priority. The maximum value of N is 10, which indicates that a filter can have up to 10 inbound rules. |
1 |
| DestinationCidrBlock |
string |
No |
The destination CIDR block of the inbound rule. |
10.0.0.0/24 |
| SourcePortRange |
string |
No |
The source port range of the inbound rule. Valid values for port numbers: 1 to 65535. Separate the start port and end port with a forward slash (/). Format: 1/200 or 80/80. Note
If IngressRules.N.Protocol is set to ALL or ICMP, this parameter does not need to be set, which indicates that all ports are available. |
80/120 |
| EgressRules |
array<object> |
No |
The information about the outbound rules. |
|
|
object |
No |
The information about the outbound rules. |
||
| Action |
string |
Yes |
The collection policy of the outbound rule. Valid values:
|
accept |
| SourceCidrBlock |
string |
No |
The source CIDR block of the outbound rule. |
10.0.0.0/24 |
| Protocol |
string |
Yes |
The protocol type of the network traffic to be mirrored for the outbound rule. Valid values:
|
TCP |
| IpVersion |
string |
Yes |
The IP version of the instance. Valid values:
|
IPv4 |
| DestinationPortRange |
string |
No |
The destination port range of the outbound rule. Valid values for port numbers: 1 to 65535. Separate the start port and end port with a forward slash (/). Format: 1/200 or 80/80. The value -1/-1 cannot be set independently and indicates that all ports are available. Note
If EgressRules.N.Protocol is set to ALL or ICMP, this parameter does not need to be set, which indicates that all ports are available. |
22/40 |
| Priority |
integer |
No |
The priority of the outbound rule. A smaller value indicates a higher priority. The maximum value of N is 10, which indicates that a filter can have up to 10 outbound rules. |
1 |
| DestinationCidrBlock |
string |
No |
The destination CIDR block of the outbound rule. |
10.0.0.0/24 |
| SourcePortRange |
string |
No |
The source port range of the outbound rule. Valid values for port numbers: 1 to 65535. Separate the start port and end port with a forward slash (/). Format: 1/200 or 80/80. The value -1/-1 cannot be set independently and indicates that all ports are available. Note
If EgressRules.N.Protocol is set to ALL or ICMP, this parameter does not need to be set, which indicates that all ports are available. |
22/40 |
| RegionId |
string |
Yes |
The region ID of the traffic mirror. You can call the DescribeRegions operation to query the region ID. For more information about the regions that support traffic mirroring, see Traffic Mirroring overview. |
cn-hongkong |
| ResourceGroupId |
string |
No |
The ID of the resource group to which the traffic mirror belongs. |
rg-bp67acfmxazb4ph**** |
| Tag |
array<object> |
No |
The tags of the resource. |
|
|
object |
No |
The tag. |
||
| Key |
string |
No |
The tag key of the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot start with |
FinanceDept |
| Value |
string |
No |
The tag value of the resource. You can specify up to 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot start with |
FinanceJoshua |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The instance ID of the traffic mirror filter. |
||
| TrafficMirrorFilterId |
string |
The instance ID of the traffic mirror filter. |
tmf-j6cmls82xnc86vtpe**** |
| RequestId |
string |
The request ID. |
28DB147D-217B-43E8-9E94-A3F6837DDC8A |
| ResourceGroupId |
string |
The ID of the resource group to which the traffic mirror belongs. |
rg-bp67acfmxazb4ph**** |
Examples
Success response
JSON format
{
"TrafficMirrorFilterId": "tmf-j6cmls82xnc86vtpe****",
"RequestId": "28DB147D-217B-43E8-9E94-A3F6837DDC8A",
"ResourceGroupId": "rg-bp67acfmxazb4ph****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | UnsupportedFeature.IpVersion | The ipversion type is not supported. | |
| 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 | QuotaExceeded.TrafficMirrorFilter | The maximum number of traffic image filters is exceeded. | The number of filters has reached the upper limit. |
| 400 | DuplicatedParam.Priority | The specified priority conflicts with the existing priority. | The specified priority is the same as an existing one. |
| 400 | UnsupportedRegion | The feature is not supported in current region. | The feature is not supported in the current region. |
| 400 | IllegalParamFormat.SrcCidrBlock | The format of the specified source CIDR block is invalid. | The error message returned because the format of the source CIDR block is invalid. |
| 400 | IllegalParamFormat.DstCidrBlock | The format of the specified dst CIDR block is invalid. | The format of the destination CIDR block is invalid. |
| 400 | IllegalParam.DestinationCidrBlock | The param of DestinationCidrBlock %s is illegal. | |
| 400 | IllegalParam.SourceCidrBlock | The param of SourceCidrBlock %s is illegal. | |
| 400 | IllegalParam.Protocol | The specified Protocol %s is invalid. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.