Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the acf domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Deprecated: Creation of dynamic property ACF::$fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields.php on line 138

Deprecated: Creation of dynamic property acf_loop::$loops is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 28

Deprecated: Creation of dynamic property ACF::$loop is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 269

Deprecated: Creation of dynamic property ACF::$revisions is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/revisions.php on line 397

Deprecated: Creation of dynamic property acf_validation::$errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 28

Deprecated: Creation of dynamic property ACF::$validation is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 214

Deprecated: Creation of dynamic property acf_form_customizer::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 28

Deprecated: Creation of dynamic property acf_form_customizer::$preview_fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 29

Deprecated: Creation of dynamic property acf_form_customizer::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 30

Deprecated: Creation of dynamic property ACF::$form_front is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php on line 598

Deprecated: Creation of dynamic property acf_form_widget::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 34

Deprecated: Creation of dynamic property acf_form_widget::$preview_reference is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 35

Deprecated: Creation of dynamic property acf_form_widget::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 36

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the all-in-one-wp-migration domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp_plugin/wp_plugin.php on line 23

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 54

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1539

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 828

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rocket domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Deprecated: Creation of dynamic property acf_field_oembed::$width is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 31

Deprecated: Creation of dynamic property acf_field_oembed::$height is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 32

Deprecated: Creation of dynamic property acf_field_google_map::$default_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php on line 33

Deprecated: Creation of dynamic property acf_field__group::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php on line 31

Deprecated: Creation of dynamic property acf_field_clone::$cloning is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 34

Deprecated: Creation of dynamic property acf_field_clone::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 35

Deprecated: Creation of dynamic property jh_acf_field_table::$settings is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-table-field/class-jh-acf-field-table.php on line 23

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902
{"id":24879,"date":"2020-03-30T12:46:15","date_gmt":"2020-03-30T09:46:15","guid":{"rendered":"https:\/\/upcloud.com\/community\/tutorials\/upcloud-metadata-service"},"modified":"2020-03-30T12:46:15","modified_gmt":"2020-03-30T09:46:15","slug":"upcloud-metadata-service","status":"publish","type":"tutorial","link":"https:\/\/studiogo.tech\/upcloudold\/tutorial\/upcloud-metadata-service\/","title":{"rendered":"How to use UpCloud Metadata service"},"content":{"rendered":"\n

UpCloud provides a Metadata service that allows you to query information on already deployed cloud servers to get information about the server itself. The data can be utilised as the basis for the automatic configuration of the servers after the initial deployment.<\/p>\n\n\n\n

\n
Test hosting on UpCloud!<\/a><\/div>\n<\/div>\n\n\n\n

Enabling the metadata service<\/h2>\n\n\n\n

Metadata service can be selected at deployment or enabled on any existing Cloud Servers at your UpCloud Control Panel or via the API. For example, the Metadata service is used to include your SSH keys and run initialization scripts at deployment.<\/p>\n\n\n\n

The feature can be turned on or off at the deployment page under the Optional settings.<\/p>\n\n\n\n

\"Metadata<\/figure>\n\n\n\n

Cloud Servers deployed without the service can enable it at any point without the need to restart the server. This can be done either via the UpCloud control panel or the UpCloud API.<\/p>\n\n\n\n

You can find the option to turn on Metadata in your Cloud Server settings under the Optional settings.<\/p>\n\n\n\n

\"Metadata<\/figure>\n\n\n\n

Alternatively, you can enable the metadata service with a simple API request. Replace the server-UUID<\/span> with the UUID of your cloud server.<\/p>\n\n\n\n

PUT \/1.3\/server\/server-UUID<\/span>\/<\/pre>\n\n\n\n
{\n   \"server\": {\n      \"metadata\": \"yes\"\n    }\n}<\/pre>\n\n\n\n

If you\u2019ve not used the UpCloud API before, have a look at our getting started tutorial<\/a> to learn more.<\/p>\n\n\n\n

Listing all metadata<\/h2>\n\n\n\n

Metadata is available to be queried through all networks: public, utility and SDN private networks.<\/p>\n\n\n\n

The metadata is available as a cloud-init compatible JSON and via a filesystem-like traversable API. Both can be queried on any of your cloud servers using any HTTP client such as curl<\/tt> or wget<\/tt>.<\/p>\n\n\n\n

For example, you can use the following request to view all of the metadata available on your cloud server.<\/p>\n\n\n\n

curl http:\/\/169.254.169.254\/metadata\/v1.json<\/pre>\n\n\n\n
{\n  \"cloud_name\": \"upcloud\",\n  \"instance_id\": \"00bf9504-a4cb-4839-88ff-124a2c95e169\",\n  \"hostname\": \"metadata.example.com\",\n  \"platform\": \"servers\",\n  \"subplatform\": \"metadata (http:\/\/169.254.169.254)\",\n  \"public_keys\": [\n    \"ssh-rsa AAAAB[...]ud1Cw== max@upcloud.com\"\n  ],\n  \"region\": \"de-fra1\",\n  \"network\": {\n    \"interfaces\": [\n      {\n        \"index\": 1,\n        \"ip_addresses\": [\n          {\n            \"address\": \"94.237.90.209\",\n            \"dhcp\": true,\n            \"dns\": [\n              \"94.237.127.9\",\n              \"94.237.40.9\"\n            ],\n            \"family\": \"IPv4\",\n            \"floating\": false,\n            \"gateway\": \"94.237.90.1\",\n            \"network\": \"94.237.90.0\/24\"\n          }\n        ],\n        \"mac\": \"de:ad:be:ef:3f:c5\",\n        \"network_id\": \"03030473-8e9d-4f4f-bcfe-b2c300391a07\",\n        \"type\": \"public\"\n      },\n      {\n        \"index\": 2,\n        \"ip_addresses\": [\n          {\n            \"address\": \"10.199.12.11\",\n            \"dhcp\": true,\n            \"dns\": null,\n            \"family\": \"IPv4\",\n            \"floating\": false,\n            \"gateway\": \"10.199.12.1\",\n            \"network\": \"10.199.12.0\/24\"\n          }\n        ],\n        \"mac\": \"de:ad:be:ef:9f:ff\",\n        \"network_id\": \"03318153-4e70-4ba5-8e74-69538582188d\",\n        \"type\": \"utility\"\n      },\n      {\n        \"index\": 3,\n        \"ip_addresses\": [\n          {\n            \"address\": \"2a04:3540:1000:811:9809:21ff:fe8b:5962\",\n            \"dhcp\": true,\n            \"dns\": [\n              \"2a04:3540:53::1\",\n              \"2a04:3544:53::1\"\n            ],\n            \"family\": \"IPv6\",\n            \"floating\": false,\n            \"gateway\": \"2a04:3540:1000:811::1\",\n            \"network\": \"2a04:3540:1000:811::\/64\"\n          }\n        ],\n        \"mac\": \"9a:09:21:8b:59:62\",\n        \"network_id\": \"03000000-0000-4000-8002-000000000000\",\n        \"type\": \"public\"\n      }\n    ],\n    \"dns\": [\n      \"94.237.127.9\",\n      \"94.237.40.9\"\n    ]\n  },\n  \"storage\": {\n    \"disks\": [\n      {\n        \"id\": \"0187b8c5-7220-4c90-9026-047dff8be0b3\",\n        \"serial\": \"0187b8c572204c909026\",\n        \"size\": 25,\n        \"type\": \"disk\",\n        \"tier\": \"maxiops\"\n      }\n    ]\n  },\n  \"tags\": [\n    \"dev\",\n    \"metadata\"\n  ],\n  \"user_data\": \"apt-get update && apt-get -y upgrade\",\n  \"vendor_data\": \"\"\n}<\/pre>\n\n\n\n

Getting specific metadata<\/h2>\n\n\n\n

UpCloud metadata service can also be accessed via a filesystem-like traversable API. This allows you to find specific data about resources that can include multiples of the same type, for example, storage and networks.<\/p>\n\n\n\n

List all available fields with the following request.<\/p>\n\n\n\n

curl http:\/\/169.254.169.254\/metadata\/v1\/<\/pre>\n\n\n\n
cloud_name\ninstance_id\nhostname\nplatform\nsubplatform\npublic_keys\nregion\nnetwork\/\nstorage\/\ntags\nuser_data\nvendor_data<\/pre>\n\n\n\n

Specific information can be retrieved using the full path of the field, for example, with the request below to get the cloud server region.<\/p>\n\n\n\n

curl http:\/\/169.254.169.254\/metadata\/v1\/region<\/pre>\n\n\n\n
fi-hel1<\/pre>\n\n\n\n

Data fields with the \/ icon at the end indicate nested fields that work like directories. You can traverse these directories to view their content. For example, you can list the network interfaces using the request below.<\/p>\n\n\n\n

curl http:\/\/169.254.169.254\/metadata\/v1\/network\/interfaces\/<\/pre>\n\n\n\n
1\/\n2\/\n3\/<\/pre>\n\n\n\n

You can get detailed information about any of the network interfaces by going further into the data structure. For example, find the IP address on the first interface which usually holds the public IP.<\/p>\n\n\n\n

curl http:\/\/169.254.169.254\/metadata\/v1\/network\/interfaces\/1\/ip_addresses\/0\/address<\/pre>\n\n\n\n
94.237.90.209<\/pre>\n\n\n\n

The metadata can then be used to configure applications and services which require server-specific information that is not known before deployment.<\/p>\n","protected":false},"featured_media":13989,"comment_status":"open","ping_status":"closed","template":"","community-category":[109,117,122],"class_list":["post-24879","tutorial","type-tutorial","status-publish","has-post-thumbnail","hentry","community-category-upcloud-services","community-category-automation","community-category-api"],"acf":[],"_links":{"self":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/tutorial\/24879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/types\/tutorial"}],"replies":[{"embeddable":true,"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/comments?post=24879"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/media\/13989"}],"wp:attachment":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/media?parent=24879"}],"wp:term":[{"taxonomy":"community-category","embeddable":true,"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/community-category?post=24879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}