0

Update a configuration profile

by
Published Oct 17, 2025

Updates a configuration profile.

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * Update a configuration profile
7
 * Updates a configuration profile.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  linodeId: string,
13
  configId: string,
14
  body: {
15
    comments?: string;
16
    devices?: {
17
      sda?: { disk_id?: number; volume_id?: number };
18
      sdb?: { disk_id?: number; volume_id?: number };
19
      sdc?: { disk_id?: number; volume_id?: number };
20
      sdd?: { disk_id?: number; volume_id?: number };
21
      sde?: { disk_id?: number; volume_id?: number };
22
      sdf?: { disk_id?: number; volume_id?: number };
23
      sdg?: { disk_id?: number; volume_id?: number };
24
      sdh?: { disk_id?: number; volume_id?: number };
25
    };
26
    helpers?: {
27
      devtmpfs_automount?: false | true;
28
      distro?: false | true;
29
      modules_dep?: false | true;
30
      network?: false | true;
31
      updatedb_disabled?: false | true;
32
    };
33
    id?: number;
34
    interfaces?: {
35
      active?: false | true;
36
      id?: number;
37
      ip_ranges?: string[];
38
      ipam_address?: string;
39
      ipv4?: { nat_1_1?: string; vpc?: string };
40
      label?: string;
41
      primary?: false | true;
42
      purpose: "public" | "vlan" | "vpc";
43
      subnet_id?: number;
44
      vpc_id?: number;
45
    }[];
46
    kernel?: string;
47
    label?: string;
48
    memory_limit?: number;
49
    root_device?: string;
50
    run_level?: "default" | "single" | "binbash";
51
    virt_mode?: "paravirt" | "fullvirt";
52
  },
53
) {
54
  const url = new URL(
55
    `https://api.linode.com/${apiVersion}/linode/instances/${linodeId}/configs/${configId}`,
56
  );
57

58
  const response = await fetch(url, {
59
    method: "PUT",
60
    headers: {
61
      "Content-Type": "application/json",
62
      Authorization: "Bearer " + auth.token,
63
    },
64
    body: JSON.stringify(body),
65
  });
66
  if (!response.ok) {
67
    const text = await response.text();
68
    throw new Error(`${response.status} ${text}`);
69
  }
70
  return await response.json();
71
}
72