
The news is too simple to make complex liner -
now DigitalOcean has Metadata, its own metadata server . What for? For anything, but first of all for managing droplets (virtual servers, in DO terminology).
Metadata is a service provided for DigitalOcean droplets, allowing each server to get information about itself (the so-called metadata). As an example of such data, you can cite data about users, droplet ID, data center region, and IP address data. In addition to simply receiving droplet metadata, Metadata allows users to transfer certain data to droplets when they are created, which can be used by CloudInit to facilitate the configuration of cloud servers.
Metadata is currently available for new droplets in the following regions: SGP1, SFO1, LON1, AMS2, AMS3, and NYC3. If the droplet is in one of these regions, and the metadata is not available, it is recommended to turn off and turn on the droplet.
')
Full documentation on Metadata is available on the
DigitalOcean Developer Portal .
When creating a droplet, metadata is set in the droplet control panel, in the “Available Settings” section, in the “user data” field:

If you create droplets using the DigitalOcean API, you can pass the metadata as a user_data parameter in a POST request to create a server:
curl -X POST "https://api.digitalocean.com/v2/droplets" \ -d'{"name":"metadata.example.com","region":"nyc3","size":"512mb","private_networking":true,"image":"ubuntu-14-04-x64","user_data": "'"$(cat ~/user-data.yaml)"'", "ssh_keys":[ <SSH KEY IDs> ]}' \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json"
Receiving metadata also looks simple: just make an HTTP GET request for a special URL.
http://169.254.169.254/metadata/v1/
. The answer will contain the data:
id hostname user-data vendor-data public-keys region interfaces/ dns/
Information is stored hierarchically, so more detailed queries such as
169.254.169.254/metadata/v1/user-data
169.254.169.254/metadata/v1/user-data
or
169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address
169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address
, will allow you to get the data specified in the “user data” field, or, respectively, the public IPv4 address of the droplet.