Policies are a set of restrictions that your fleet will follow to create deployments in specific locations. Without them, your fleet will simply not work. That being said, you will need at least one policy, but you can add multiple ones to create deployments at many locations on a single fleet.
We will continue our fleet for the North American continent to better understand.
Let's say we want these parameters for our policy:
- A minimum of 3 deployments
- A maximum of 10 deployments
- We want our deployment to scale when 80% of the capacity is reached
- We only want deployment in North America
Name: The name of your policy. It must be unique within the fleet.
Enabled: If your policy is enabled or not. As opposed to the fleets, we recommend letting it enabled by default, so you don't have to go back to enable it. The policy won't do any deployments until the fleet is enabled.
Minimum: The minimum amount of deployment that must be running at any time for this policy. It is required to be at least one otherwise the fleet policy would not make any deployments.
Maximum: The maximum amount of deployments that the policy can scale up. If left empty or null in the API, it can scale as much as needed. Be aware that with scaling comes costs, but if your game starts scaling fast, it's probably a good sign for your game.
Threshold: Based on the number of sockets connected, how filled should a Session deployment be before initiating a scale up deployment. As said before, only the session-based app versions are eligible for the fleet. It is a number between 0.1 and 1 (e.g. 0.8 = 80%) that represents the percentage at which the fleet should create a new deployment for this policy when the previous deployment reaches this threshold. Really low value could result in over scaling and generating unwanted costs. See Session capacity for a better understanding of how deployments/sessions capacity works.
Type: The type of policy will determine what kind of JSON body will be valid in the data field. It can either be:
- Location - The filters will be of geographical type like a city, country, continent, etc. This is the type you will most likely use.
- Tag - The filters will be based on in-house tags like infrastructure or CPU type. This is a more advanced way to filter your policy. You can get the available tags with the API Doc.
- Coordinates - This type allows you to input a latitude/longitude coordinates as the point where you want your deployments to be. We will try to make the deployments as close as possible to the coordinates.
Data: This field will vary depending on the type. It will be a list of filters for Location and Tag. For the Point type, it will be a dictionary with coordinates. In the next section, we will go through every type in detail and how to create the associated data.