Description of the Metadata API
Tilaa has implemented an Amazon EC2 compatible metadata service. Just like Amazon EC2, it's running at http://169.254.169.254/
The metadata service is most commonly used to bootstrap servers at first boot, using a tool like cloud-init or cloud-config.
Three Types of Metadata
Descriptive Metadata
Describes a resource for purposes such as discovery and identification. It can include elements such as title, abstract, author, and keywords.
Structural Metadata
Indicates how compound objects are put together, for example, how pages are ordered to form chapters.
Administrative Metadata
Provides information to help manage a resource, such as when and how it was created, file type and other technical information, and who can access it. There are several subsets of administrative data; two that are sometimes listed as separate metadata types are:
- Rights Management Metadata, which deals with intellectual property rights.
- Preservation Metadata, which contains information needed to archive and preserve a resource.
Querying the Metadata Service from Your VPS
You can query the metadata service from your VPS, for example using curl commands:
$ curl http://169.254.169.254/latest/meta-data/instance-id
50977499-7c1c-477e-957f-0ecb2e1327bf
Using Tools like Cloud-Init
Tools like cloud-init can be used to configure your VPS. For example, you can use the following configuration snippet to set up a user:
users:
- name: foobar
gecos: Foo Bar
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
ssh_import_id: None
lock_passwd: true
ssh_authorized_keys:
- <ssh pub key 1>
- <ssh pub key 2>
Configuration Examples
Here are some more configuration examples:
users:
- name: cloudy
gecos: Magic Cloud App Daemon User
inactive: '5'
system: true
- name: fizzbuzz
sudo: False
ssh_authorized_keys:
- <ssh pub key 1>
- <ssh pub key 2>
- snapuser: joe@joeuser.io
- name: nosshlogins
ssh_redirect_user: true
For more in-depth information, you can check cloud-init's documentation.