• Bare Metal Server

bms
  1. Help Center
  2. Bare Metal Server
  3. User Guide
  4. Instance
  5. Metadata

Metadata

BMS metadata is used to configure or manage running BMSs. Table 1 lists the two sets of APIs that BMS metadata supports.
Table 1 BMS metadata categories

API Type

Metadata Type

Description

Compatibility

OpenStack metadata API

Metadata

This interface is used to query BMS metadata.

Supported

GET Password

This interface is used to query the BMS password.

Supported

User Data

This interface is used to query BMS user data.

Supported

POST Password

This interface is used to store the BMS password.

Supported

Security Key

This interface is used to obtain temporary AKs and SKs.

Supported

EC2 compatible APIs

ami-id

This interface is used to query the BMS image ID.

Supported

ami-launch-index

This interface is used to query the BMS launching sequence.

Supported

block-device-mapping

This interface is used to query the block device of a BMS.

Supported

hostname

This interface is used to query the host name of a BMS.

Supported

instance-id

This interface is used to query the BMS ID.

Supported

instance-type

This interface is used to query the flavor name of a BMS.

Supported

local-ipv4

This interface is used to query the fixed IP address of a BMS.

Supported

availability-zone

This interface is used to query AZ information about a BMS.

Supported

public-ipv4

This interface is used to query the floating IP address of a BMS.

Supported

public-keys

This interface is used to query the public key of a BMS.

Supported

user-data

This interface is used to query BMS user data.

Supported

ami-manifest-path

This interface is used to query the path where an image list is stored.

Not supported

reservation-id

This interface is used to query the reserved ID of a BMS.

Not supported

instance-action

This interface is used to query operations on a BMS.

Not supported

kernel-id

This interface is used to query the kernel image ID of a BMS.

Not supported

local-hostname

This interface is used to query the local name of a BMS.

Not supported

public-hostname

This interface is used to query the public name of a BMS.

Not supported

ramdisk-id

This interface is used to query the ramdisk image ID of a BMS.

Not supported

security-groups

This interface is used to query the security group to which a BMS belongs.

Not supported

The following describes the URI and methods of using the supported BMS metadata.

Prerequisites

Security group rules in the outbound direction meet the following requirements:

  • Protocol: TCP
  • Port Range: 80
  • Remote End: 169.254.0.0/16
NOTE:

If you use the default security group rules in the outbound direction, the preceding requirements are met, and the metadata can be accessed. The default outbound security group rule is as follows:

  • Protocol: ANY
  • Port Range: ANY
  • Remote End: 0.0.0.0/16

Metadata (OpenStack Metadata API)

This interface is used to query BMS metadata.

  • URI

    /169.254.169.254/openstack/{version}/meta_data.json

  • Method

    Supports GET requests.

  • Example

    The following describes how to use the cURL tool to query the BMS metadata:

    curl http://169.254.169.254/openstack/latest/meta_data.json

    {
        "admin_pass": "sWs9YVAiytTs",
        "availability_zone": "manage-az",
        "files": [
            {
                "content_path": "/content/0000",
                "path": "/etc/litao.ini"
            }
        ],
        "hostname": "lt-test-01.novalocal",
        "launch_index": 0,
        "meta": {
            "test_key": "test_vaule"
        },
        "name": "lt-test-01",
        "public_keys": {
            "novakey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCr4Mk6fRqbPRXE3lq9NivYvrysz0/D+gAWCgKCG46lU+x3aLRRtUwpSoX4W7FtRegHAp7EpIhmW40vM+9HrKEZbQsaiyfe0VP/cHZFKJLU9cnDJNMIb0WoIjLWDORnUnsfZL1tFaYyIcAdIl6TuB92sj4Bg8xrYCn3nfNtSSfHHszvHIc0kys7AC+ellL4NWlyeGDSkmsHS0vnIP0mpRgpB2QShmx/ZEIQQ+YxMoL8z+A44+v/V+/R8K7aJK3LbQ8Yu8vwky9M1OLG176s9pQnTmdlrKNWc4dYC8zNRxaFvyuUO9FD71OSEkmoZwkbhYHmIVIw49d0OIr63ok8mMij root@6B1AA2D2-3B57-11DA-8567-000000821800\n"
        },
        "random_seed": "ptvKzBu5SNFrWKAiar62VT7KOGZS38T3VdpEjRDmBOwF0RGKvjNGXasAXZo8KfzBPCq+MupA4Ig9mUyHWJiAcI7IvOQV7EWubJ4pxQn2tNxrwRR7VdSR8WJUqeZV1FjxxgxjJkQtnWmrT57J+SEaqzRP64ONYdikPnBlOIpnsj+gKMXxDmFL3tQ0ljC2vKdZdbjc8QkT84/dnbJpx/DaatkiLWVVTmlGhP72j/0NH1JbAnv5EECS5z51h2YFnRxJOJFlSCwnl5UuFRjsO82T+7usRjK0IXAvDIKcqQlzrV5WWXrWc1e+yejIjjVvAGad5PcjLeaGaEEBNo5eBJ9e4FZHLkkUV7naYGsLiOLjO3qZjvFM1gcaKsrv92/Ys2DbwHFfV0Xo/uNA9Jx7MFIXELdNOfDP8nS4fVp52w6KOUvQ1iEhEBaOlQVKENJ6jfbSYCoYe4JGK/UeGCaVhjZPpe8L9nVjn2QYfe6e/p1TxRk1MFe6LgrpQXR8SzEJ71+X6j+pRvP8Ui8W1M88esq+ZqbjjIpAxR9ISmd/aTM7WGa7OLOXxDsWQDBAH7J/86u4P1Zebs6vFgORM+RUc2PFAOMSEQ2Ak0UlhX9FrqoK9plol7x9m8aQAj0Sd89lMiCDTgVbk8DSZA4qT5lnYzqZYAvg9XWItCLkeM+C05P7748=",
        "uuid": "32274de3-6efe-45b3-86a8-46c4335ffeb7"
    }

Password (OpenStack Metadata API)

This interface is used to query or store the BMS password.

  • URI

    /169.254.169.254/openstack/{version}/password

  • Method

    Supports both GET and POST requests.

    • The GET request is used to query the password.
    • The POST request is used to store the password. Exercise caution when sending a POST request.
  • Example
    • Example 1: Query the password for logging in to a BMS.

      curl http://169.254.169.254/openstack/latest/password

      v59nTqCebJKtNnDu
    • Example 2: Store the password for logging in to a BMS.

      curl -X POST http://169.254.169.254/openstack/latest/password -d "v59nTqCebJKtNnDu"

User Data (OpenStack Metadata API)

This interface is used to query BMS user data. The value is configured when you create a BMS. It cannot be changed after the configuration.

  • URI

    /169.254.169.254/openstack/{version}/user_data

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/openstack/latest/user_data

    ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA==

Security Key (OpenStack Metadata API)

This interface is used to obtain temporary AKs and SKs.

NOTE:
  • If you need to obtain temporary AKs ad SKs on a BMS, authorize the op_svc_ecs account on the IAM service.
  • Temporary AKs and SKs expire an hour later.
  • When using temporary AKs and SKs, add 'X-Security-Token':securitytoken in the message header. securitytoken is the value returned when a call is made to the API.
  • URI

    /openstack/{version}/securitykey

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/openstack/{version}/securitykey

User Data (EC2 Compatible API)

This interface is used to query BMS user data. The value is configured when you create a BMS. It cannot be changed after the configuration.

  • URI

    /169.254.169.254/{version}/user-data

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/user-data

    ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA==

Ami ID (EC2 Compatible API)

This interface is used to query the ID of the image used to start a BMS.

  • URI

    /169.254.169.254/{version}/meta-data/ami-id

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/ami-id

    ami-00000003

Ami Launch Index (EC2 Compatible API)

This interface is used to query the sequence of starting BMSs. If you start multiple BMSs using an API, the value indicates the BMS start sequence. The value for the BMS to start first is 0.

  • URI

    /169.254.169.254/{version}/meta-data/ami-launch-index

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/ami-launch-index

Block Device Mapping (EC2 Compatible API)

This interface is used to query the block device of a BMS.

  • URI

    /169.254.169.254/{version}/meta-data/block-device-mapping/ami

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/block-device-mapping/ami

    vda

Hostname (EC2 Compatible API)

This interface is used to query the name of the host accommodating a BMS. The .novalocal suffix will be added later.

  • URI

    /169.254.169.254/{version}/meta-data/hostname

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/hostname

    bms-test.novalocal

Instance ID (EC2 Compatible API)

This interface is used to query the BMS ID.

  • URI

    /169.254.169.254/{version}/meta-data/instance-id

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/instance-id

    i-00000001

Instance Type (EC2 Compatible API)

This interface is used to query the flavor name of a BMS.

  • URI

    /169.254.169.254/{version}/meta-data/instance-type

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/instance-type

    physical.o2.medium

Local IPv4 (EC2 Compatible API)

This interface is used to query the fixed IP address of a BMS.

  • URI

    /169.254.169.254/{version}/meta-data/local-ipv4

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/local-ipv4

    192.1.1.2

Availability Zone (EC2 Compatible API)

This interface is used to query AZ information about a BMS.

  • URI

    /169.254.169.254/{version}/meta-data/placement/availability-zone

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/placement/availability-zone

    az1.dc1

Public IPv4 (EC2 Compatible API)

This interface is used to query the floating IP address of a BMS.

  • URI

    /169.254.169.254/{version}/meta-data/public-ipv4

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/public-ipv4

    46.1.1.2

Public Keys (EC2 Compatible API)

This interface is used to query the public key of a BMS.

  • URI

    /169.254.169.254/latest/meta-data/public-keys/0/openssh-key

  • Method

    Supports GET requests.

  • Example

    curl http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDI5Fw5k8Fgzajn1zJwLoV3+wMP+6CyvsSiIc/hioggSnYu/AD0Yqm8vVO0kWlun1rFbdO+QUZKyVr/OPUjQSw4SRh4qsTKf/+eFoWTjplFvd1WCBZzS/WRenxIwR00KkczHSJro763+wYcwKieb4eKRxaQoQvoFgVjLBULXAjH4eKoKTVNtMXAvPP9aMy2SLgsJNtMb9ArfziAiblQynq7UIfLnN3VclzPeiWrqtzjyOp6CPUXnL0lVPTvbLe8sUteBsJZwlL6K4i+Y0lf3ryqnmQgC21yW4Dzu+kwk8FVT2MgWkCwiZd8gQ/+uJzrJFyMfUOBIklOBfuUENIJUhAB Generated-by-Nova