> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.iot.telia.lt/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.iot.telia.lt/_mcp/server.

# Create a Cloud Connect attachment via IPSec VPN

POST https://iot.telia.lt/api/v1/cnc/breakout/vpn
Content-Type: application/json

Creates a Cloud Connect attachment via a specified VPN server.
Currently two attachment types are available:

* **Static VPN** (type `2`): Basic IPSec VPN connection
* **Dynamic VPN with BGP** (type `3`): IPSec VPN with BGP routing.
  Requires `asn` (Autonomous System Number), otherwise dynamic routing is disabled.
  Optionally accepts `inside_cidr` for BGP tunnel interfaces.

The `on_prem_cidr` parameter specifies the CIDR ranges of your backend network (up to 3).
The `public_ip` is the public IP address of your VPN server.

A `psk` (Pre-Shared Key) can be configured with 8-64 alphanumeric characters, periods (`.`), and underscores (`_`).
It must not begin with `0`.
If left empty, it generates automatically and can be retrieved via [`GET /api/v1/cnc/breakout/{cloudconnect_attachment_id}`](/developers/api/cloud-connect/get-cloud-connect-attachment-by-id).

The created connection is available within 3-5 minutes.

Reference: https://docs.iot.telia.lt/developers/api/cloud-connect/create-cloud-connect-attachment-vpn

## Authentication

- `Authorization` header (bearer token, required) — An `auth_token` should be provided to authenticate a session. To obtain an `auth_token`, see the [`/api/v1/authenticate` **POST** request](/developers/api/authentication/authenticate).

## Request

### Body (application/json)

This endpoint expects an object.

- `type` (ApiV1CncBreakoutVpnPostRequestBodyContentApplicationJsonSchemaType, required) — Breakout type. Use `2` for Static VPN or `3` for Dynamic VPN with BGP.
- `name` (string, required) — Display name for the Cloud Connect attachment.
- `public_ip` (string, required) — Public IP address of your VPN server.
- `on_prem_cidr` (list of string, required) — CIDR ranges of your backend network. You can configure up to 3 ranges.
- `description` (string, optional) — Optional description for the attachment.
- `region` (string, optional) — AWS region for the attachment (for example, `eu-west-1`).
- `psk` (string, optional) — Pre-shared key (PSK) for the VPN connection. If empty, AWS generates one automatically.
- `asn` (integer, optional) — Autonomous System Number (ASN) for BGP routing. Required for Dynamic VPN (type `3`)."
- `inside_cidr` (list of string, optional) — For Dynamic VPN only: /30 CIDR ranges for BGP tunnel interfaces (up to 3). If empty, AWS generates them automatically.

## Response

### 201

Attachment created successfully. The `Location` header contains the URL of the new resource.

## Errors

### 400 Bad Request Error

The request body is malformed or missing required fields.

- `any`

### 403 Forbidden Error

Your authentication token is valid, but you don't have permission to access the requested resource.

- `any`

## Types

### ApiV1CncBreakoutVpnPostRequestBodyContentApplicationJsonSchemaType

Breakout type. Use `2` for Static VPN or `3` for Dynamic VPN with BGP.

- `id` (enum, required) — Attachment type identifier.
  - Allowed values: `2`, `3`

## Examples

### Static VPN

**Request**

```json
{
  "type": {
    "id": 2
  },
  "name": "Demo Attachment Static VPN",
  "public_ip": "192.0.2.1",
  "on_prem_cidr": [
    "10.0.0.0/24"
  ],
  "region": "eu-west-1",
  "psk": "secret"
}
```

**Response**

```json
{}
```

**SDK Code**

```python Static VPN
import requests

url = "https://iot.telia.lt/api/v1/cnc/breakout/vpn"

payload = {
    "type": { "id": 2 },
    "name": "Demo Attachment Static VPN",
    "public_ip": "192.0.2.1",
    "on_prem_cidr": ["10.0.0.0/24"],
    "region": "eu-west-1",
    "psk": "secret"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Static VPN
const url = 'https://iot.telia.lt/api/v1/cnc/breakout/vpn';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"type":{"id":2},"name":"Demo Attachment Static VPN","public_ip":"192.0.2.1","on_prem_cidr":["10.0.0.0/24"],"region":"eu-west-1","psk":"secret"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Static VPN
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://iot.telia.lt/api/v1/cnc/breakout/vpn"

	payload := strings.NewReader("{\n  \"type\": {\n    \"id\": 2\n  },\n  \"name\": \"Demo Attachment Static VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Static VPN
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/cnc/breakout/vpn")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": {\n    \"id\": 2\n  },\n  \"name\": \"Demo Attachment Static VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret\"\n}"

response = http.request(request)
puts response.read_body
```

```java Static VPN
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://iot.telia.lt/api/v1/cnc/breakout/vpn")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": {\n    \"id\": 2\n  },\n  \"name\": \"Demo Attachment Static VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret\"\n}")
  .asString();
```

```php Static VPN
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://iot.telia.lt/api/v1/cnc/breakout/vpn', [
  'body' => '{
  "type": {
    "id": 2
  },
  "name": "Demo Attachment Static VPN",
  "public_ip": "192.0.2.1",
  "on_prem_cidr": [
    "10.0.0.0/24"
  ],
  "region": "eu-west-1",
  "psk": "secret"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Static VPN
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/cnc/breakout/vpn");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": {\n    \"id\": 2\n  },\n  \"name\": \"Demo Attachment Static VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Static VPN
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": ["id": 2],
  "name": "Demo Attachment Static VPN",
  "public_ip": "192.0.2.1",
  "on_prem_cidr": ["10.0.0.0/24"],
  "region": "eu-west-1",
  "psk": "secret"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/cnc/breakout/vpn")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Dynamic VPN with BGP

**Request**

```json
{
  "type": {
    "id": 3
  },
  "name": "Demo Attachment Dynamic VPN",
  "public_ip": "192.0.2.1",
  "on_prem_cidr": [
    "10.0.0.0/24"
  ],
  "region": "eu-west-1",
  "psk": "secret123",
  "asn": 65000
}
```

**Response**

```json
{}
```

**SDK Code**

```python Dynamic VPN with BGP
import requests

url = "https://iot.telia.lt/api/v1/cnc/breakout/vpn"

payload = {
    "type": { "id": 3 },
    "name": "Demo Attachment Dynamic VPN",
    "public_ip": "192.0.2.1",
    "on_prem_cidr": ["10.0.0.0/24"],
    "region": "eu-west-1",
    "psk": "secret123",
    "asn": 65000
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Dynamic VPN with BGP
const url = 'https://iot.telia.lt/api/v1/cnc/breakout/vpn';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"type":{"id":3},"name":"Demo Attachment Dynamic VPN","public_ip":"192.0.2.1","on_prem_cidr":["10.0.0.0/24"],"region":"eu-west-1","psk":"secret123","asn":65000}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Dynamic VPN with BGP
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://iot.telia.lt/api/v1/cnc/breakout/vpn"

	payload := strings.NewReader("{\n  \"type\": {\n    \"id\": 3\n  },\n  \"name\": \"Demo Attachment Dynamic VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret123\",\n  \"asn\": 65000\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Dynamic VPN with BGP
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/cnc/breakout/vpn")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": {\n    \"id\": 3\n  },\n  \"name\": \"Demo Attachment Dynamic VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret123\",\n  \"asn\": 65000\n}"

response = http.request(request)
puts response.read_body
```

```java Dynamic VPN with BGP
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://iot.telia.lt/api/v1/cnc/breakout/vpn")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": {\n    \"id\": 3\n  },\n  \"name\": \"Demo Attachment Dynamic VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret123\",\n  \"asn\": 65000\n}")
  .asString();
```

```php Dynamic VPN with BGP
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://iot.telia.lt/api/v1/cnc/breakout/vpn', [
  'body' => '{
  "type": {
    "id": 3
  },
  "name": "Demo Attachment Dynamic VPN",
  "public_ip": "192.0.2.1",
  "on_prem_cidr": [
    "10.0.0.0/24"
  ],
  "region": "eu-west-1",
  "psk": "secret123",
  "asn": 65000
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Dynamic VPN with BGP
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/cnc/breakout/vpn");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": {\n    \"id\": 3\n  },\n  \"name\": \"Demo Attachment Dynamic VPN\",\n  \"public_ip\": \"192.0.2.1\",\n  \"on_prem_cidr\": [\n    \"10.0.0.0/24\"\n  ],\n  \"region\": \"eu-west-1\",\n  \"psk\": \"secret123\",\n  \"asn\": 65000\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Dynamic VPN with BGP
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": ["id": 3],
  "name": "Demo Attachment Dynamic VPN",
  "public_ip": "192.0.2.1",
  "on_prem_cidr": ["10.0.0.0/24"],
  "region": "eu-west-1",
  "psk": "secret123",
  "asn": 65000
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/cnc/breakout/vpn")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```