create_game_session
¶
create_game_session(
*,
config_overrides: Optional[GameLiftClientConfig] = None,
fleet_id: Optional[FleetIdOrArn] = None,
alias_id: Optional[AliasIdOrArn] = None,
maximum_player_session_count: Optional[WholeNumber] = None,
name: Optional[NonZeroAndMaxString] = None,
game_properties: Optional[GamePropertyList] = None,
creator_id: Optional[NonZeroAndMaxString] = None,
game_session_id: Optional[IdStringModel] = None,
idempotency_token: Optional[IdStringModel] = None,
game_session_data: Optional[LargeGameSessionData] = None,
location: Optional[LocationStringModel] = None,
) -> CreateGameSessionOutput
This API works with the following fleet types: EC2, Anywhere, Container
Creates a multiplayer game session for players in a specific fleet location. This operation prompts an available server process to start a game session and retrieves connection information for the new game session. As an alternative, consider using the Amazon GameLift Servers game session placement feature with StartGameSessionPlacement, which uses the FleetIQ algorithm and queues to optimize the placement process.
When creating a game session, you specify exactly where you want to place it and provide a set of game session configuration settings. The target fleet must be in ACTIVE status.
You can use this operation in the following ways:
-
To create a game session on an instance in a fleet's home Region, provide a fleet or alias ID along with your game session configuration.
-
To create a game session on an instance in a fleet's remote location, provide a fleet or alias ID and a location name, along with your game session configuration.
-
To create a game session on an instance in an Anywhere fleet, specify the fleet's custom location.
If successful, Amazon GameLift Servers initiates a workflow to start a new game session and returns a GameSession object containing the game session configuration and status. When the game session status is ACTIVE, it is updated with connection information and you can create player sessions for the game session. By default, newly created game sessions are open to new players. You can restrict new player access by using UpdateGameSession to change the game session's player session creation policy.
Amazon GameLift Servers retains logs for active game sessions for 14 days. To access the logs, call GetGameSessionLogUrl to download the log files.
Available in Amazon GameLift Servers Local.
Learn more
Parameters:
-
fleet_id(Optional[FleetIdOrArn], default:None) –A unique identifier for the fleet to create a game session in. You can use either the fleet ID or ARN value. Each request must reference either a fleet ID or alias ID, but not both.
-
alias_id(Optional[AliasIdOrArn], default:None) –A unique identifier for the alias associated with the fleet to create a game session in. You can use either the alias ID or ARN value. Each request must reference either a fleet ID or alias ID, but not both.
-
maximum_player_session_count(Optional[WholeNumber], default:None) –The maximum number of players that can be connected simultaneously to the game session.
-
name(Optional[NonZeroAndMaxString], default:None) –A descriptive label that is associated with a game session. Session names do not need to be unique.
-
game_properties(Optional[GamePropertyList], default:None) –A set of key-value pairs that can store custom data in a game session. For example:
{"Key": "difficulty", "Value": "novice"}. For an example, see Create a game session with custom properties.-
Avoid using periods (".") in property keys if you plan to search for game sessions by properties. Property keys containing periods cannot be searched and will be filtered out from search results due to search index limitations.
-
If you use SearchGameSessions API, there is a limit of 500 game property keys across all game sessions and all fleets per region. If the limit is exceeded, there will potentially be game session entries missing from SearchGameSessions API results.
-
-
creator_id(Optional[NonZeroAndMaxString], default:None) –A unique identifier for a player or entity creating the game session.
If you add a resource creation limit policy to a fleet, the
CreateGameSessionoperation requires aCreatorId. Amazon GameLift Servers limits the number of game session creation requests with the sameCreatorIdin a specified time period.If your fleet doesn't have a resource creation limit policy and you provide a
CreatorIdin yourCreateGameSessionrequests, Amazon GameLift Servers limits requests to one request perCreatorIdper second.To not limit
CreateGameSessionrequests with the sameCreatorId, don't provide aCreatorIdin yourCreateGameSessionrequest. -
game_session_id(Optional[IdStringModel], default:None) –This parameter is deprecated. Use
IdempotencyTokeninstead.Custom string that uniquely identifies a request for a new game session. Maximum token length is 48 characters. If provided, this string is included in the new game session's ID.
-
idempotency_token(Optional[IdStringModel], default:None) –Custom string that uniquely identifies the new game session request. This is useful for ensuring that game session requests with the same idempotency token are processed only once. Subsequent requests with the same string return the original
GameSessionobject, with an updated status. Maximum token length is 48 characters. If provided, this string is included in the new game session's ID. The value is always a full ARN in the following format: For Home Region game session -arn:aws:gamelift:. For Remote Location game session -::gamesession/ / arn:aws:gamelift:. Idempotency tokens remain in use for 30 days after a game session has ended; game session objects are retained for this time period and then deleted.::gamesession/ / / -
game_session_data(Optional[LargeGameSessionData], default:None) –A set of custom game session properties, formatted as a single string value. This data is passed to a game server process with a request to start a new game session. For more information, see Start a game session.
-
location(Optional[LocationStringModel], default:None) –A fleet's remote location to place the new game session in. If this parameter is not set, the new game session is placed in the fleet's home Region. Specify a remote location with an Amazon Web Services Region code such as
us-west-2. When using an Anywhere fleet, this parameter is required and must be set to the Anywhere fleet's custom location.
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.
-
FleetCapacityExceededException–The specified fleet has no available instances to fulfill a
CreateGameSessionrequest. Clients can retry such requests immediately or after a waiting period. -
IdempotentParameterMismatchException–A game session with this custom ID string already exists in this fleet. Resolve this 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.
-
InvalidFleetStatusException–The requested operation would cause a conflict with the current state of a resource associated with the request and/or the fleet. Resolve the conflict before retrying.
-
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.
-
NotFoundException–The requested resource was not found. The resource was either not created yet or deleted.
-
TerminalRoutingStrategyException–The service is unable to resolve the routing for a particular alias because it has a terminal
RoutingStrategyassociated with it. The message returned in this exception is the message defined in the routing strategy itself. Such requests should only be retried if the routing strategy for the specified alias is modified. -
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
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 | |