# Instancetypecapacity

The InstanceTypeCapacity element is a child of the [HostCapacityTemplate](/game-hosting/elements/deploymentenvironment/hostcapacitytemplate.md) and defines how many game instances you want deployed on a certain BM instance type and / or VM instance type. during creation, you provide the ID of the HostCapacityTemplate that you want this element to become part of.

## Element Structure

| Property               | Value type | Required  | Description                                                                                                                                                          |
| ---------------------- | ---------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                     | string     | Read-only | Unique identifier of this element                                                                                                                                    |
| hostCapacityTemplateId | string     | Read-only | The ID of the HostCapacityTemplate it is a child of                                                                                                                  |
| providerId             | int        | Yes       | The ID of the `/cloud/provider` to which the `instanceType` property applies                                                                                         |
| instanceType           | string     | Yes       | The name of the instance type to which the `capacity` applies. See GET /cloud/instanceType (for virtual servers) and GET /host/instanceType (for bare metal servers) |
| isVirtual              | int        | Read-only | `1` if the instance type is a virtual server, `0` if it is a bare metal server                                                                                       |
| capacity               | int        | Yes       | The capacity (number of instances) of the instance type. Minimum value: 1, maximum value: 60                                                                         |
| createdAt              | int        | Read-only | A unix timestamp of when this element was created                                                                                                                    |

Table 1: InstanceTypeCapacity element structure

## Obtaining BM and VM instance types

You can get a list of BM instance types using the `/host/instanceType` endpoint.

You can get a list of VM instance types using the `/cloud/instanceType` endpoint.

Note that within this InstanceTypeCapacity element you must provide the name of the instance type and not the ID. This is because the HostCapacityTemplate is region agnostic and therefore we have to use the names and not the IDs of the instance types.

## Capacity explained

The capacity you indicate is related to the amount of physical cores in a machine. It is therefore important to differentiate between BMs and VMs, because the core count of VMs is usually indicated as vCpus, which are based on logical cores (threads) and not physical cores.

The maximum number of game server instances you can deploy per physical core is 60.

The following table illustrates a few different examples:

| Machine type | CPU Cores | Maximum number of game server instances |
| ------------ | --------- | --------------------------------------- |
| BM           | 4 cores   | 4 \* 60 = 240                           |
| BM           | 16 cores  | 16 \* 60 = 960                          |
| BM           | 64 cores  | 64 \* 60 = 3840                         |
| VM           | 4 vCpus   | 4 \_ 0.5 \_ 60 = 120                    |
| VM           | 16 vCpus  | 16 \_ 0.5 \_ 60 = 480                   |
| VM           | 64 vCpus  | 64 \_ 0.5 \_ 60 = 1920                  |

## Assignment to a HostCapacityTemplate

Assignment of an InstanceTypeCapacity element to a HostCapacityTemplate is done during creation of this element by providing the ID of the HostCapacityTemplate in the `hostCapacityTemplateId` property.

## API example

Create a new InstanceTypeCapacity for an already existing HostCapacityTemplate.

[Full API reference](/game-hosting/elements/deploymentenvironment/hostcapacitytemplate/instancetypecapacity.md)

#### HTTP request

[`POST /v3/hostCapacityTemplate/{hostCapacityTemplateId}/instanceTypeCapacity`](https://www.i3d.net/docs/api/v3/game-publisher#/InstanceTypeCapacity/createHostCapacityTemplateInstanceTypeCapacity)

#### Request body

```
{
  "providerId": 31,
  "instanceType": "c2-standard-8",
  "capacity": 8
}
```

#### Response body

```
[
  {
    "id": "4847342966680359842",
    "hostCapacityTemplateId": "4943474277300823573",
    "providerId": 31,
    "instanceType": "c2-standard-8",
    "isVirtual": 1,
    "capacity": 8,
    "createdAt": 1579009662
  }
]
```

## Related element

This element is a child of the [HostCapacityTemplate](/game-hosting/elements/deploymentenvironment/hostcapacitytemplate.md) element.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.i3d.net/game-hosting/elements/deploymentenvironment/hostcapacitytemplate/instancetypecapacity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
