Updating ECS Metadata
Function
This API is used to update ECS metadata.
- If the metadata does not contain the field to be updated, the field is automatically added.
- If the metadata contains the field to be updated, the field value is automatically updated.
- If the field in the metadata is not requested, the field value remains unchanged.

If the metadata contains sensitive data, take appropriate measures to protect the sensitive data, for example, controlling access permissions and encrypting the data.
Constraints
An ECS must be in active, stopped, paused, or suspended state, which is specified by OS-EXT-STS:vm_state.
Debugging
You can debug this API in API Explorer.
Authorization
- If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
- If you are using identity policy-based authorization, the permissions listed below are required.
Action | Access Level | Resource Type (*: required) | Condition Key | Alias | Dependencies |
|---|---|---|---|---|---|
ecs:cloudServers:updateMetadata | write | instance * | - | - | iam:agencies:pass |
URI
POST /v1/{project_id}/cloudservers/{server_id}/metadata
Parameter | Mandatory | Description |
|---|---|---|
project_id | Yes | Definition Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
server_id | Yes | Definition Specifies the ECS ID. Constraints N/A Range N/A Default Value N/A |
Request
Parameter | Mandatory | Type | Description |
|---|---|---|---|
metadata | Yes | Map<String,String> | Definition This API is used to update ECS metadata. You can use metadata to customize key-value pairs. For details about reserved key-value pairs, see Table 11. Constraints If the metadata contains sensitive data, take appropriate measures to protect the sensitive data, for example, controlling access permissions and encrypting the data. Range
Default Value N/A |
Response
Parameter | Type | Description |
|---|---|---|
metadata | Object | Definition Specifies the user-defined metadata key-value pair. Range N/A |
Example Request
Updated the metadata of an ECS with the user-defined metadata key-value pair.
POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/metadata
{
"metadata": {
"key": "value"
}
} Example Response
{
"metadata":{
"key":"value"
}
} Returned Values
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
