create_game_session
async
¶
create_game_session(
*,
config_overrides: Optional[AsyncGameLiftClientConfig] = 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/async_game_lift.py
1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 | |