Port

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

Bases: object

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

Stability:

experimental

ExampleMetadata:

infused

Example:

# build: gamelift.Build


fleet = gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=build,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="/local/game/GameLiftExampleServer.x86_64"
        )]
    ),
    ingress_rules=[gamelift.IngressRule(
        source=gamelift.Peer.any_ipv4(),
        port=gamelift.Port.tcp_range(100, 200)
    )]
)
# Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.add_ingress_rule(gamelift.Peer.ipv4("1.2.3.4/32"), gamelift.Port.udp(1111))
Parameters:
  • from_port (Union[int, float]) – (experimental) A starting value for a range of allowed port numbers. For fleets using Windows and Linux builds, only ports 1026-60000 are valid.

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

  • to_port (Union[int, float, None]) – (experimental) An ending value for a range of allowed port numbers. Port numbers are end-inclusive. This value must be higher than fromPort. For fleets using Windows and Linux builds, only ports 1026-60000 are valid. Default: the fromPort value

Stability:

experimental

Methods

to_json()

(experimental) Produce the ingress rule JSON for the given connection.

Stability:

experimental

Return type:

Any

Static Methods

classmethod all_tcp()

(experimental) Any TCP traffic.

Stability:

experimental

Return type:

Port

classmethod all_udp()

(experimental) Any UDP traffic.

Stability:

experimental

Return type:

Port

classmethod tcp(port)

(experimental) A single TCP port.

Parameters:

port (Union[int, float]) –

Stability:

experimental

Return type:

Port

classmethod tcp_range(start_port, end_port)

(experimental) A TCP port range.

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

  • end_port (Union[int, float]) –

Stability:

experimental

Return type:

Port

classmethod udp(port)

(experimental) A single UDP port.

Parameters:

port (Union[int, float]) –

Stability:

experimental

Return type:

Port

classmethod udp_range(start_port, end_port)

(experimental) A UDP port range.

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

  • end_port (Union[int, float]) –

Stability:

experimental

Return type:

Port