EC2 / Client / create_traffic_mirror_filter_rule

create_traffic_mirror_filter_rule#

EC2.Client.create_traffic_mirror_filter_rule(**kwargs)#

Creates a Traffic Mirror filter rule.

A Traffic Mirror rule defines the Traffic Mirror source traffic to mirror.

You need the Traffic Mirror filter ID when you create the rule.

See also: AWS API Documentation

Request Syntax

response = client.create_traffic_mirror_filter_rule(
    TrafficMirrorFilterId='string',
    TrafficDirection='ingress'|'egress',
    RuleNumber=123,
    RuleAction='accept'|'reject',
    DestinationPortRange={
        'FromPort': 123,
        'ToPort': 123
    },
    SourcePortRange={
        'FromPort': 123,
        'ToPort': 123
    },
    Protocol=123,
    DestinationCidrBlock='string',
    SourceCidrBlock='string',
    Description='string',
    DryRun=True|False,
    ClientToken='string'
)
Parameters:
  • TrafficMirrorFilterId (string) –

    [REQUIRED]

    The ID of the filter that this rule is associated with.

  • TrafficDirection (string) –

    [REQUIRED]

    The type of traffic.

  • RuleNumber (integer) –

    [REQUIRED]

    The number of the Traffic Mirror rule. This number must be unique for each Traffic Mirror rule in a given direction. The rules are processed in ascending order by rule number.

  • RuleAction (string) –

    [REQUIRED]

    The action to take on the filtered traffic.

  • DestinationPortRange (dict) –

    The destination port range.

    • FromPort (integer) –

      The first port in the Traffic Mirror port range. This applies to the TCP and UDP protocols.

    • ToPort (integer) –

      The last port in the Traffic Mirror port range. This applies to the TCP and UDP protocols.

  • SourcePortRange (dict) –

    The source port range.

    • FromPort (integer) –

      The first port in the Traffic Mirror port range. This applies to the TCP and UDP protocols.

    • ToPort (integer) –

      The last port in the Traffic Mirror port range. This applies to the TCP and UDP protocols.

  • Protocol (integer) –

    The protocol, for example UDP, to assign to the Traffic Mirror rule.

    For information about the protocol value, see Protocol Numbers on the Internet Assigned Numbers Authority (IANA) website.

  • DestinationCidrBlock (string) –

    [REQUIRED]

    The destination CIDR block to assign to the Traffic Mirror rule.

  • SourceCidrBlock (string) –

    [REQUIRED]

    The source CIDR block to assign to the Traffic Mirror rule.

  • Description (string) – The description of the Traffic Mirror rule.

  • DryRun (boolean) – 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.

  • ClientToken (string) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'TrafficMirrorFilterRule': {
        'TrafficMirrorFilterRuleId': 'string',
        'TrafficMirrorFilterId': 'string',
        'TrafficDirection': 'ingress'|'egress',
        'RuleNumber': 123,
        'RuleAction': 'accept'|'reject',
        'Protocol': 123,
        'DestinationPortRange': {
            'FromPort': 123,
            'ToPort': 123
        },
        'SourcePortRange': {
            'FromPort': 123,
            'ToPort': 123
        },
        'DestinationCidrBlock': 'string',
        'SourceCidrBlock': 'string',
        'Description': 'string'
    },
    'ClientToken': 'string'
}

Response Structure

  • (dict) –

    • TrafficMirrorFilterRule (dict) –

      The Traffic Mirror rule.

      • TrafficMirrorFilterRuleId (string) –

        The ID of the Traffic Mirror rule.

      • TrafficMirrorFilterId (string) –

        The ID of the Traffic Mirror filter that the rule is associated with.

      • TrafficDirection (string) –

        The traffic direction assigned to the Traffic Mirror rule.

      • RuleNumber (integer) –

        The rule number of the Traffic Mirror rule.

      • RuleAction (string) –

        The action assigned to the Traffic Mirror rule.

      • Protocol (integer) –

        The protocol assigned to the Traffic Mirror rule.

      • DestinationPortRange (dict) –

        The destination port range assigned to the Traffic Mirror rule.

        • FromPort (integer) –

          The start of the Traffic Mirror port range. This applies to the TCP and UDP protocols.

        • ToPort (integer) –

          The end of the Traffic Mirror port range. This applies to the TCP and UDP protocols.

      • SourcePortRange (dict) –

        The source port range assigned to the Traffic Mirror rule.

        • FromPort (integer) –

          The start of the Traffic Mirror port range. This applies to the TCP and UDP protocols.

        • ToPort (integer) –

          The end of the Traffic Mirror port range. This applies to the TCP and UDP protocols.

      • DestinationCidrBlock (string) –

        The destination CIDR block assigned to the Traffic Mirror rule.

      • SourceCidrBlock (string) –

        The source CIDR block assigned to the Traffic Mirror rule.

      • Description (string) –

        The description of the Traffic Mirror rule.

    • ClientToken (string) –

      Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency.