Port

class aws_cdk.aws_ec2.Port(*, protocol, string_representation, from_port=None, to_port=None)

Bases: object

Interface for classes that provide the connection-specification parts of a security group rule.

__init__(*, protocol, string_representation, from_port=None, to_port=None)
Parameters
  • props

  • protocol (Protocol) – The protocol for the range.

  • string_representation (str) – String representation for this object.

  • from_port (Union[int, float, None]) – The starting port for the range. Default: - Not included in the rule

  • to_port (Union[int, float, None]) – The ending port for the range. Default: - Not included in the rule

Return type

None

Methods

to_rule_json()

Produce the ingress/egress rule JSON for the given connection.

Return type

Any

to_string()
Return type

str

Attributes

can_inline_rule

Whether the rule containing this port range can be inlined into a securitygroup or not.

Return type

bool

Static Methods

classmethod all_icmp()

All ICMP traffic.

Return type

Port

classmethod all_tcp()

Any TCP traffic.

Return type

Port

classmethod all_traffic()

All traffic.

Return type

Port

classmethod all_udp()

Any UDP traffic.

Return type

Port

classmethod icmp_ping()

ICMP ping (echo) traffic.

Return type

Port

classmethod icmp_type(type)

All codes for a single ICMP type.

Parameters

type (Union[int, float]) –

Return type

Port

classmethod icmp_type_and_code(type, code)

A specific combination of ICMP type and code.

Parameters
  • type (Union[int, float]) –

  • code (Union[int, float]) –

see :see: https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml

Return type

Port

classmethod tcp(port)

A single TCP port.

Parameters

port (Union[int, float]) –

Return type

Port

classmethod tcp_range(start_port, end_port)

A TCP port range.

Parameters
  • start_port (Union[int, float]) –

  • end_port (Union[int, float]) –

Return type

Port

classmethod udp(port)

A single UDP port.

Parameters

port (Union[int, float]) –

Return type

Port

classmethod udp_range(start_port, end_port)

A UDP port range.

Parameters
  • start_port (Union[int, float]) –

  • end_port (Union[int, float]) –

Return type

Port