• Elastic Cloud Server

ecs
  1. Help Center
  2. Elastic Cloud Server
  3. API Reference
  4. OpenStack Nova APIs
  5. Metadata Management
  6. Configuring ECS Metadata

Configuring ECS Metadata

Function Description

This interface is used to configure ECS metadata.

When you call this interface, all the metadata of this ECS will be deleted, and the ECS uses the value configured in the request.

Constraints

The ECS must be in the active, stopped, paused, or suspended state. That is, the value of the OS-EXT-STS:vm_state attribute of the ECS must be active, stopped, paused, or suspended.

URI

PUT /v2/{project_id}/servers/{server_id}/metadata

PUT /v2.1/{project_id}/servers/{server_id}/metadata

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request

Parameter

Type

Mandatory

Description

metadata

Dict

Yes

Specifies the user-defined metadata key-value pair.

Table 3 Data structure description of the metadata field

Parameter

Type

Mandatory

Description

key

Yes

String

Specifies the key name.

The value contains a maximum of 255 Unicode characters and cannot be empty. It can contain letters in upper or lower cases, digits, hyphens (-), underscores (_), colons (:), and periods (.).

value

Yes

String

Specifies the key value.

The value can contain a maximum of 255 Unicode characters.

Response

Response parameters

Table 4 describes the response parameters.

Table 4 Response parameters

Parameter

Type

Description

metadata

Dict

Specifies the user-defined metadata key-value pair.

Examples

  • Example request
    {
    "metadata": {
                "key1": "value1",
                "key2": "value2"
    }
    }
  • Example response
    {
    "metadata": {
                "key1": "value1",
                "key2": "value2"
    }
    }

Returned Values

See General Request Returned Values.