create_container_group_definition
¶
create_container_group_definition(
*,
config_overrides: Optional[GameLiftClientConfig] = None,
name: Optional[ContainerGroupDefinitionName] = None,
container_group_type: Optional[ContainerGroupType] = None,
total_memory_limit_mebibytes: Optional[ContainerTotalMemoryLimit] = None,
total_vcpu_limit: Optional[ContainerTotalVcpuLimit] = None,
game_server_container_definition: Optional[
GameServerContainerDefinitionInput
] = None,
support_container_definitions: Optional[SupportContainerDefinitionInputList] = None,
operating_system: Optional[ContainerOperatingSystem] = None,
version_description: Optional[NonZeroAndMaxString] = None,
tags: Optional[TagList] = None,
) -> CreateContainerGroupDefinitionOutput
This API works with the following fleet types: Container
Creates a ContainerGroupDefinition that describes a set of containers for hosting your game server with Amazon GameLift Servers managed containers hosting. An Amazon GameLift Servers container group is similar to a container task or pod. Use container group definitions when you create a container fleet with CreateContainerFleet.
A container group definition determines how Amazon GameLift Servers deploys your containers to each instance in a container fleet. You can maintain multiple versions of a container group definition.
There are two types of container groups:
-
A game server container group has the containers that run your game server application and supporting software. A game server container group can have these container types:
-
Game server container. This container runs your game server. You can define one game server container in a game server container group.
-
Support container. This container runs software in parallel with your game server. You can define up to 8 support containers in a game server group.
When building a game server container group definition, you can choose to bundle your game server executable and all dependent software into a single game server container. Alternatively, you can separate the software into one game server container and one or more support containers.
On a container fleet instance, a game server container group can be deployed multiple times (depending on the compute resources of the instance). This means that all containers in the container group are replicated together.
-
-
A per-instance container group has containers for processes that aren't replicated on a container fleet instance. This might include background services, logging, test processes, or processes that need to persist independently of the game server container group. When building a per-instance container group, you can define up to 10 support containers.
This operation requires Identity and Access Management (IAM) permissions to access container images in Amazon ECR repositories. See IAM permissions for Amazon GameLift Servers for help setting the appropriate permissions.
Request options
Use this operation to make the following types of requests. You can specify values for the minimum required parameters and customize optional values later.
-
Create a game server container group definition. Provide the following required parameter values:
-
Name -
ContainerGroupType(GAME_SERVER) -
OperatingSystem -
TotalMemoryLimitMebibytes -
Either
TotalVcpuLimitor aVcpuvalue for the game server container -
At least one
GameServerContainerDefinition-
ContainerName -
ImageUrl -
PortConfiguration -
ServerSdkVersion
-
-
-
Create a per-instance container group definition. Provide the following required parameter values:
-
Name -
ContainerGroupType(PER_INSTANCE) -
OperatingSystem -
TotalMemoryLimitMebibytes -
TotalVcpuLimit -
At least one
SupportContainerDefinition-
ContainerName -
ImageUrl
-
-
Results
If successful, this request creates a ContainerGroupDefinition resource and assigns a unique ARN value. You can update most properties of a container group definition by calling UpdateContainerGroupDefinition, and optionally save the update as a new version.
Parameters:
-
name(Optional[ContainerGroupDefinitionName], default:None) –A descriptive identifier for the container group definition. The name value must be unique in an Amazon Web Services Region.
-
container_group_type(Optional[ContainerGroupType], default:None) –The type of container group being defined. Container group type determines how Amazon GameLift Servers deploys the container group on each fleet instance.
Default value:
GAME_SERVER -
total_memory_limit_mebibytes(Optional[ContainerTotalMemoryLimit], default:None) –The maximum amount of memory (in MiB) to allocate to the container group. All containers in the group share this memory. If you specify memory limits for an individual container, the total value must be greater than any individual container's memory limit.
Default value: 1024
-
total_vcpu_limit(Optional[ContainerTotalVcpuLimit], default:None) –The maximum amount of vCPU units to allocate to the container group (1 vCPU is equal to 1024 CPU units). All containers in the group share these resources. If you set vCPU reservations for individual containers, the total value must be equal to or greater than the sum of the
Vcpuvalues for all containers in the group.This property is required for a per-instance container group.
For a game server container group, Amazon GameLift Servers requires either a total vCPU limit or a
Vcpuvalue for the game server container. If you set a total vCPU limit for a game server container group, Amazon GameLift Servers uses this value to calculate how many game server container groups fit on an instance. If you don't set a total vCPU limit, the group's containers can use up to the instance's available vCPU, and Amazon GameLift Servers uses the sum of the containers'Vcpuvalues to calculate how many game server container groups fit on an instance. -
game_server_container_definition(Optional[GameServerContainerDefinitionInput], default:None) –The definition for the game server container in this group. Define a game server container only when the container group type is
GAME_SERVER. Game server containers specify a container image with your game server build. You can pass in your container definitions as a JSON file. -
support_container_definitions(Optional[SupportContainerDefinitionInputList], default:None) –One or more definition for support containers in this group. You can define a support container in any type of container group. You can pass in your container definitions as a JSON file.
-
operating_system(Optional[ContainerOperatingSystem], default:None) –The platform that all containers in the group use. Containers in a group must run on the same operating system.
Default value:
AMAZON_LINUX_2023Amazon Linux 2 (AL2) will reach end of support on 6/30/2026. See more details in the Amazon Linux 2 FAQs. For game servers that are hosted on AL2 and use server SDK version 4.x for Amazon GameLift Servers, first update the game server build to server SDK 5.x, and then deploy to AL2023 instances. See Migrate to server SDK version 5.
-
version_description(Optional[NonZeroAndMaxString], default:None) –A description for the initial version of this container group definition.
-
tags(Optional[TagList], default:None) –A list of labels to assign to the container group definition resource. Tags are developer-defined key-value pairs. Tagging Amazon Web Services resources is useful for resource management, access management and cost allocation. For more information, see Tagging Amazon Web Services Resources in the Amazon Web Services General Reference.
Raises:
-
ConflictException–The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.
-
InternalServiceException–The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.
-
InvalidRequestException–One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.
-
LimitExceededException–The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.
-
TaggingFailedException–The requested tagging operation did not succeed. This may be due to invalid tag format or the maximum tag limit may have been exceeded. Resolve the issue before retrying.
-
UnauthorizedException–The client failed authentication. Clients should not retry such requests.
-
UnsupportedRegionException–The requested operation is not supported in the Region specified.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_gamelift/_services/game_lift.py
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | |