DescribeContainerGroupPortMappings
This API works with the following fleet types: Container
Retrieves the port mappings for a container group running on a container fleet. Port mappings show how container ports are mapped to connection ports on the fleet instance. Use this operation to find the connection port for a specific container on a fleet instance.
Request options
-
Get port mappings for a game server container group. Provide the fleet ID, set
ContainerGroupTypetoGAME_SERVER, and specify theComputeNamefor the game server container group. -
Get port mappings for a per-instance container group. Provide the fleet ID, set
ContainerGroupTypetoPER_INSTANCE, and specify theInstanceIdfor the instance. -
Optionally filter results to a single container by providing a
ContainerName.
Results
This operation returns the fleet ID, location, container group definition
ARN, container group type, compute name (for game server container groups), instance ID,
and a list of ContainerGroupPortMapping objects. Each object contains the
container name, runtime ID, and a list of port mappings that show how container ports map
to connection ports on the instance.
Learn more
Create a container group definition
Request Syntax
{
"ComputeName": "string",
"ContainerGroupType": "string",
"ContainerName": "string",
"FleetId": "string",
"InstanceId": "string"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
Note
In the following list, the required parameters are described first.
- ContainerGroupType
-
The type of container group to retrieve port mappings for.
-
GAME_SERVER-- Get port mappings for a game server container group. -
PER_INSTANCE-- Get port mappings for a per-instance container group.
Type: String
Valid Values:
GAME_SERVER | PER_INSTANCERequired: Yes
-
- FleetId
-
A unique identifier for the container fleet. You can use either the fleet ID or ARN value.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 512.
Pattern:
^[a-z]*fleet-[a-zA-Z0-9\-]+$|^arn:.*:[a-z]*fleet\/[a-z]*fleet-[a-zA-Z0-9\-]+$Required: Yes
- ComputeName
-
A unique identifier for the compute resource for which to retrieve port mappings. For a container fleet, a compute represents a game server container group running on a fleet instance. You can use either the compute name or ARN value.
When
ContainerGroupTypeisGAME_SERVER, this parameter is required.When
ContainerGroupTypeisPER_INSTANCE, do not provide this parameter. If you provide a compute name withPER_INSTANCE, the request fails with anInvalidRequestException.Type: String
Length Constraints: Maximum length of 1024.
Pattern:
^[a-zA-Z0-9\-]+(\/[a-zA-Z0-9\-]+)?$|^arn:.*:compute\/[a-zA-Z0-9\-]+(\/[a-zA-Z0-9\-]+)?Required: No
- ContainerName
-
A container name to filter the results. When provided, the operation returns port mappings for the specified container only. If no container with the specified name exists in the container group, the request fails with a
NotFoundException.If not provided, the operation returns port mappings for all containers in the container group.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 128.
Pattern:
^[a-zA-Z0-9\-]+$Required: No
- InstanceId
-
A unique identifier for the fleet instance to retrieve port mappings for.
When
ContainerGroupTypeisPER_INSTANCE, this parameter is required.When
ContainerGroupTypeisGAME_SERVER, this parameter is optional. If you provide an instance ID, it must match the instance that's running the specified compute. If the instance ID doesn't match, the request fails with anInvalidRequestException.Type: String
Pattern:
[a-zA-Z0-9\.-]+Required: No
Response Syntax
{
"ComputeName": "string",
"ContainerGroupDefinitionArn": "string",
"ContainerGroupPortMappings": [
{
"ContainerName": "string",
"ContainerPortMappings": [
{
"ConnectionPort": number,
"ContainerPort": number,
"Protocol": "string"
}
],
"ContainerRuntimeId": "string"
}
],
"ContainerGroupType": "string",
"FleetId": "string",
"InstanceId": "string",
"Location": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- ComputeName
-
A unique identifier for the compute resource running the game server container group. Returned when
ContainerGroupTypeisGAME_SERVER.Type: String
Length Constraints: Minimum length of 1. Maximum length of 128.
Pattern:
^[a-zA-Z0-9\-]+(\/[a-zA-Z0-9\-]+)? - ContainerGroupDefinitionArn
-
The Amazon Resource Name (ARN) that is assigned to the container group definition. The ARN value also identifies the specific container group definition version in use.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 512.
Pattern:
^arn:.*:containergroupdefinition\/[a-zA-Z0-9\-]+(:[0-9]+)?$ - ContainerGroupPortMappings
-
A list of
ContainerGroupPortMappingobjects that describe the port mappings for each container in the container group.Type: Array of ContainerGroupPortMapping objects
- ContainerGroupType
-
The type of container group that was specified in the request. Valid values are
GAME_SERVERorPER_INSTANCE.Type: String
Valid Values:
GAME_SERVER | PER_INSTANCE - FleetId
-
A unique identifier for the container fleet.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 128.
Pattern:
^[a-z]*fleet-[a-zA-Z0-9\-]+ - InstanceId
-
A unique identifier for the fleet instance. For
GAME_SERVERrequests, this is the instance running the specified compute. ForPER_INSTANCErequests, this is the instance specified in the request.Type: String
Pattern:
[a-zA-Z0-9\.-]+ - Location
-
The location of the fleet instance, expressed as an AWS Region code, such as
us-west-2.Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
^[A-Za-z0-9\-]+
Errors
For information about the errors that are common to all actions, see Common Error Types.
- InternalServiceException
-
The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.
HTTP Status Code: 500
- InvalidRequestException
-
One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.
HTTP Status Code: 400
- LimitExceededException
-
The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.
HTTP Status Code: 400
- NotFoundException
-
The requested resources was not found. The resource was either not created yet or deleted.
HTTP Status Code: 400
- UnauthorizedException
-
The client failed authentication. Clients should not retry such requests.
HTTP Status Code: 400
- UnsupportedRegionException
-
The requested operation is not supported in the Region specified.
HTTP Status Code: 400
Examples
Get port mappings for a game server container group
This example retrieves port mappings for a game server container group running on a specific compute in a container fleet.
HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.
Sample Request
{
"FleetId": "containerfleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"ContainerGroupType": "GAME_SERVER",
"ComputeName": "62c5ff7f7a9a445d84877074c80aeafc"
}
Sample Response
{
"FleetId": "containerfleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"Location": "us-west-2",
"ContainerGroupDefinitionArn": "arn:aws:gamelift:us-west-2:111122223333:containergroupdefinition/MyGameServerContainerGroup:1",
"ContainerGroupType": "GAME_SERVER",
"ComputeName": "62c5ff7f7a9a445d84877074c80aeafc",
"InstanceId": "i-1234567890abcdef0",
"ContainerGroupPortMappings": [
{
"ContainerName": "MyGameServer",
"ContainerRuntimeId": "a1b2c3d4e5f6",
"ContainerPortMappings": [
{
"ContainerPort": 7777,
"ConnectionPort": 49200,
"Protocol": "UDP"
},
{
"ContainerPort": 8080,
"ConnectionPort": 49201,
"Protocol": "TCP"
}
]
},
{
"ContainerName": "MySidecar",
"ContainerRuntimeId": "f6e5d4c3b2a1",
"ContainerPortMappings": [
{
"ContainerPort": 9090,
"ConnectionPort": 49202,
"Protocol": "TCP"
}
]
}
]
}
Get port mappings for a per-instance container group
This example retrieves port mappings for a per-instance container group (such as daemon or logging containers) running on a specific instance in a container fleet.
HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.
Sample Request
{
"FleetId": "containerfleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"ContainerGroupType": "PER_INSTANCE",
"InstanceId": "i-1234567890abcdef0"
}
Sample Response
{
"FleetId": "containerfleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"Location": "us-west-2",
"ContainerGroupDefinitionArn": "arn:aws:gamelift:us-west-2:111122223333:containergroupdefinition/MyDaemonContainerGroup:1",
"ContainerGroupType": "PER_INSTANCE",
"InstanceId": "i-1234567890abcdef0",
"ContainerGroupPortMappings": [
{
"ContainerName": "MyLoggingAgent",
"ContainerRuntimeId": "b2c3d4e5f6a1",
"ContainerPortMappings": [
{
"ContainerPort": 8125,
"ConnectionPort": 49300,
"Protocol": "UDP"
}
]
}
]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: