Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • A VM that is not deployed (or powered off)
    • This tutorial shows a VM that is not deployed
  • An optional monitoring server
  • User with privileges to modify VMs, optionally enable monitoring, and manage backups (which work with VMs and Manage virtual machine backup configuration (because backups previously used metadata).
  • Optional: a monitoring server and a user with the privileges to Manage virtual machine metrics

...

Code Block
{
    "links": [],
    "metadata": null
}

...


Optionally enable monitoring, select metrics, and retrieve metadata again

First, To move ahead quickly in the UI, just enable "Fetch metrics" and don't select any metrics to retrieve. Then retrieve metadata again using the same GET request as in the previous step.

...

Code Block
{
    "links": [],
    "metadata": {
        "monitoring-metrics": [
            {
                "name": "cpu_time"
            },
            {
                "name": "used_mem"
            }
        ]
    }
} 

Prepare a metadata object with a VM startup script

The platform will store the VM startup script in the VM metadata under the "startup-script" key.

...

Add the startup script to the metadata object with the "startup-script" key. Don't forget to add a comma after the previous object.  After you add For our example, after adding the startup script, the metadata object should look something object looked like this:

Code Block
{
    "links": [],
    "metadata": {
        "monitoring-metrics": [
            {
                "name": "cpu_time"
            },
            {
                "name": "used_mem"
            }
        ],
        "startup-script": 
"#cloud-config\r\nhostname: \"userdatahostname\"\r\nusers:\r\n  - name: \"myuser\"\r\n  \t# mkpasswd --method=SHA-512 --rounds=4096 mypass\r\n    passwd: \"$6$rounds=4096$aD0didNw\/$Pau0z3YK2Ss5MWYoxScEedfMa.1N5qRqK0xYrgs79qdjHdoFUIRmVXpeEewDduSbImu7sqIjSRm40xO6PpJhk\/\" \r\n    groups:\r\n      - \"sudo\"\r\nssh_authorized_keys:\r\n  - \"ssh-rsa USER_ID_RSA.PUB\"" 
    }
} 

...

Although you can read the metadata here, the most complete correct and convenient way to work with VM metadata is using the metadata link -as described in the previous steps.

Delete metadata

If you ever need to delete the VM metadata, just send a DELETE request to the metadata link. But remember that this request will delete ALL metadata, leaving just the empty links list and the null metadata key, as shown in the first example when we retrieved the empty metadata object.

...