---
title: "VPC Subnets"
description: "Configure VPC subnets and attach instances to them."
url: https://community.exoscale.com/reference/api/networking/vpc/vpc-subnets/
section: reference
last_updated: 2026-10-29
---
> For AI agents: the documentation index is at https://community.exoscale.com/llms.txt. Every page is available as markdown at `<page URL>index.md` or with `Accept: text/markdown`.

# VPC Subnets

Configure VPC subnets and attach instances to them

[Read more](https://community.exoscale.com/product/networking/vpc)

## <span data-label="POST" class="pill-POST"></span>create-subnet

Create a Subnet

```
POST /vpc/{vpc-id}/subnet
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `vpc-id` | `path` | Must be a valid UUID. |

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `address-space` | string | **yes** | Whether the subnet is private or public<br/><br/>Allowed values: `private`. |
| `addressfamily` | string | **yes** | Whether the subnet supports IPv4 and/or IPv6<br/><br/>Allowed values: `inet4`. |
| `name` | string | **yes** | Subnet name, up to 255 characters. Must be unique between the subnet of the parent VPC<br/><br/>Min length: `1`. Max length: `255`. |
| `description` | string | no | Max length: `4096`. |
| `ipv4-block` | string | no | Subnet ipv4 CIDR. Must not overlap with other CIDRs of this VPC |
| `labels` | object | no |  |

<details>
<summary>Example</summary>

```json
{
  "address-space": "private",
  "addressfamily": "inet4",
  "description": "string",
  "ipv4-block": "string",
  "labels": {},
  "name": "string"
}
```
</details>


### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID<br/><br/>Must be a valid UUID. |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](https://community.exoscale.com/reference/api/_schemas/operation/index.md#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
    "link": "string"
  },
  "state": "failure"
}
```
</details>


SDK reference for `create-subnet`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.CreateSubnet) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.create_subnet) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#createSubnet(java.util.UUID,com.exoscale.sdk.model.CreateSubnetRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/index.md): `exo api create-subnet`

## <span data-label="GET" class="pill-GET"></span>get-subnet

Retrieve Subnet details

```
GET /vpc/{vpc-id}/subnet/{id}
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `vpc-id` | `path` | Must be a valid UUID. |
| `id` | `path` | Must be a valid UUID. |

### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `address-space` | string | Whether the subnet is private or public<br/><br/>Allowed values: `private`. |
| `addressfamily` | string | Whether the subnet support IPv4 and/or IPv6<br/><br/>Allowed values: `inet4`, `dual`. |
| `created-at` | string | ISO 8601 date-time. |
| `description` | string | Max length: `4096`. |
| `id` | string | Must be a valid UUID. |
| `instances` | array of [Instances](https://community.exoscale.com/reference/api/_schemas/subnet/index.md#instances) | Instances attached to the subnet |
| `ipv4-block` | string | Subnet ipv4 CIDR |
| `labels` | object |  |
| `name` | string | Min length: `1`. Max length: `255`. |

<details>
<summary>Example output</summary>

```json
{
  "address-space": "private",
  "addressfamily": "inet4",
  "created-at": "2026-01-01T00:00:00Z",
  "description": "string",
  "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
  "instances": [
    {
      "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
      "ipv4": "192.0.2.10",
      "name": "string"
    }
  ],
  "ipv4-block": "string",
  "labels": {},
  "name": "string"
}
```
</details>


SDK reference for `get-subnet`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.GetSubnet) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.get_subnet) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#getSubnet(java.util.UUID,java.util.UUID))

[CLI](https://community.exoscale.com/tools/command-line-interface/index.md): `exo api get-subnet`

## <span data-label="PUT" class="pill-PUT"></span>update-subnet

Update a Subnet

```
PUT /vpc/{vpc-id}/subnet/{id}
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `vpc-id` | `path` | Must be a valid UUID. |
| `id` | `path` | Must be a valid UUID. |

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string | no | Max length: `4096`. |
| `labels` | object | no |  |
| `name` | string | no | Min length: `1`. Max length: `255`. |

<details>
<summary>Example</summary>

```json
{
  "description": "string",
  "labels": {},
  "name": "string"
}
```
</details>


### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `address-space` | string | Whether the subnet is private or public<br/><br/>Allowed values: `private`. |
| `addressfamily` | string | Whether the subnet support IPv4 and/or IPv6<br/><br/>Allowed values: `inet4`, `dual`. |
| `created-at` | string | ISO 8601 date-time. |
| `description` | string | Max length: `4096`. |
| `id` | string | Must be a valid UUID. |
| `instances` | array of [Instances](https://community.exoscale.com/reference/api/_schemas/subnet/index.md#instances) | Instances attached to the subnet |
| `ipv4-block` | string | Subnet ipv4 CIDR |
| `labels` | object |  |
| `name` | string | Min length: `1`. Max length: `255`. |

<details>
<summary>Example output</summary>

```json
{
  "address-space": "private",
  "addressfamily": "inet4",
  "created-at": "2026-01-01T00:00:00Z",
  "description": "string",
  "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
  "instances": [
    {
      "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
      "ipv4": "192.0.2.10",
      "name": "string"
    }
  ],
  "ipv4-block": "string",
  "labels": {},
  "name": "string"
}
```
</details>


SDK reference for `update-subnet`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.UpdateSubnet) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.update_subnet) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#updateSubnet(java.util.UUID,java.util.UUID,com.exoscale.sdk.model.UpdateSubnetRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/index.md): `exo api update-subnet`

## <span data-label="DELETE" class="pill-DELETE"></span>delete-subnet

Delete a Subnet

```
DELETE /vpc/{vpc-id}/subnet/{id}
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `vpc-id` | `path` | Must be a valid UUID. |
| `id` | `path` | Must be a valid UUID. |

### Responses

Status: `204` - 204


SDK reference for `delete-subnet`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.DeleteSubnet) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.delete_subnet) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#deleteSubnet(java.util.UUID,java.util.UUID))

[CLI](https://community.exoscale.com/tools/command-line-interface/index.md): `exo api delete-subnet`


---

## Other Operations

## <span data-label="PUT" class="pill-PUT"></span>detach-instance-from-subnet

Detach a Compute instance from a Subnet

```
PUT /vpc/{vpc-id}/subnet/{subnet-id}/detach
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `vpc-id` | `path` | Must be a valid UUID. |
| `subnet-id` | `path` | Must be a valid UUID. |

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `instance` | [Target Instance](https://community.exoscale.com/reference/api/_schemas/instance-ref/index.md) | **yes** | The target instance to detach |

<details>
<summary>Example</summary>

```json
{
  "instance": {
    "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab"
  }
}
```
</details>


### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID<br/><br/>Must be a valid UUID. |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](https://community.exoscale.com/reference/api/_schemas/operation/index.md#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
    "link": "string"
  },
  "state": "failure"
}
```
</details>


SDK reference for `detach-instance-from-subnet`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.DetachInstanceFromSubnet) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.detach_instance_from_subnet) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#detachInstanceFromSubnet(java.util.UUID,java.util.UUID,com.exoscale.sdk.model.DetachInstanceFromSubnetRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/index.md): `exo api detach-instance-from-subnet`

## <span data-label="PUT" class="pill-PUT"></span>attach-instance-to-subnet

Attach a Compute instance to a Subnet

```
PUT /vpc/{vpc-id}/subnet/{subnet-id}/attach
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `vpc-id` | `path` | Must be a valid UUID. |
| `subnet-id` | `path` | Must be a valid UUID. |

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `instance` | [Target Instance](https://community.exoscale.com/reference/api/_schemas/instance-ref/index.md) | **yes** | The target instance to attach |
| `ipv4` | string | no | An optional IPv4 address assign to the instance<br/><br/>Must be a valid IPv4 address. |

<details>
<summary>Example</summary>

```json
{
  "instance": {
    "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab"
  },
  "ipv4": "192.0.2.10"
}
```
</details>


### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID<br/><br/>Must be a valid UUID. |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](https://community.exoscale.com/reference/api/_schemas/operation/index.md#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
    "link": "string"
  },
  "state": "failure"
}
```
</details>


SDK reference for `attach-instance-to-subnet`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.AttachInstanceToSubnet) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.attach_instance_to_subnet) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#attachInstanceToSubnet(java.util.UUID,java.util.UUID,com.exoscale.sdk.model.AttachInstanceToSubnetRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/index.md): `exo api attach-instance-to-subnet`

## <span data-label="GET" class="pill-GET"></span>list-subnets

List Subnets

```
GET /vpc/{vpc-id}/subnet
```

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `vpc-id` | `path` | Must be a valid UUID. |

### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `subnets` | array of [Subnet](https://community.exoscale.com/reference/api/_schemas/list-subnet-entry/index.md) |  |

<details>
<summary>Example output</summary>

```json
{
  "subnets": [
    {
      "address-space": "private",
      "addressfamily": "inet4",
      "created-at": "2026-01-01T00:00:00Z",
      "description": "string",
      "id": "a1b2c3d4-e5f6-4a5b-8c9d-0123456789ab",
      "ipv4-block": "string",
      "labels": {},
      "name": "string"
    }
  ]
}
```
</details>


SDK reference for `list-subnets`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.ListSubnets) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.list_subnets) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#listSubnets(java.util.UUID))

[CLI](https://community.exoscale.com/tools/command-line-interface/index.md): `exo api list-subnets`


