Update the Custom Properties of a Machine

After deploying a machine, you can use the IaaS APIs to update the machine with custom properties. Custom properties provide you with the flexibility to add any information about the machine that you want.
For example, machine IDs are typically autogenerated. By updating the custom properties, you can identify the machine owner and include their contact email or phone information.
  1. Assign your virtual machine ID variable.
    Assigning this variable is useful if you plan to update the machine again.
    virtual_machine_id='<
    your_virtual_machine_id
    >'
  2. Update the machine with custom property names and values that you choose.
    curl -X PATCH \ $url/iaas/api/machines/$virtual_machine_id?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" \ -H 'Content-Type: application/json' \ -d '{ "customProperties": { "additionalPropName1": "<
    custom_prop_value_1
    >", "additionalPropName2": "<
    custom_prop_value_2
    >", "additionalPropName3": "<
    custom_prop_value_3
    >" }, "description": "string", "tags": "[ { \"key\" : \"ownedBy\", \"value\": \"Rainpole\" } ]" }' | jq "."
  3. A snippet of the response lists the added custom properties.
Add a Custom Properties to Your Virtual Machine
Update the virtual machine with resource ID
42f49781-1490-4a08-ae21-8baf383a72ac
by adding custom properties.
Assign variables.
$ url='https://appliance.domain.com' $ api_version='
2021-07-15
'
Assign the virtual machine ID.
$ virtual_machine_id='42f49781-1490-4a08-ae21-8baf383a72ac'
Update the machine with custom properties.
$ curl -X PATCH \ $url/iaas/api/machines/$virtual_machine_id?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" \ -H 'Content-Type: application/json' \ -d '{ "customProperties": { "ownerName": "VMuser_Example", "ownerEmail": "VMuser_Example@mycompany.com", "ownerCell": "123.456.7890" }, "description": "string", "tags": "[ { \"key\" : \"my.enumeration.type\", \"value\": \"ec2_instance\" } ]" }' | jq "."
A snippet of the response shows that the request was successful.
... "customProperties": { "ownerName": "VMuser_Example", "ownerEmail": "VMuser_Example@mycompany.com", "ownerCell": "123.456.7890" "image": "ubuntu", "OStype": "LINUX", "imageId": "ami-b1234cc5", ... }, ...