- Newest
- Most votes
- Most comments
When you create a Managed Container fleet, you also need to provide an InstanceConnectionPortRange. Here's how the port mapping works:
As a container starts up, it gets assigned:
A container port (same as the Internal container port provided during ContainerGroupDefinition creation)
A connection port (One of the ports from InstanceConnectionPortRange)
Each container port is assigned a corresponding connection port, which can be used to connect to the container from outside. For more details, check the Game Client/Server connections section in the AWS GameLift documentation.
Let's look at your example (Assuming the InstanceConnectionPortRange to be the value mentioned below):
Container port range: 33430-33440 (for both TCP and UDP protocols)
InstanceConnectionPortRange: 1000-1200
This would result in port mappings like:
TCP Ports: 33430-33440 → connection ports 1000-1010
UDP Ports: 33430-33440 → connection ports 1011-1021
Important Note: As you can see from the example listed above, TCP and UDP port ranges are mapped to distinct sets of connection ports.
This is why you can only connect to your udp port from by using the connection port mentioned in CreateGameSession response. (We also default to udp port in such cases where we can't determine if the game server is using tcp or udp port and the ContainerGroupDefinition mentions same port ranges for both protocols)
Currently, there isn't a straightforward API method to obtain these port mappings (AWS is aware of this limitation and looking into it). For now, To view these port mappings, you'll need to:
- Access the instance running the container using GetComputeAccess API
- Run the docker ps command to see all port mappings assigned to containers
Relevant content
- asked a year ago
- asked 3 years ago
- AWS OFFICIALUpdated 8 months ago
