All Products
Search
Document Center

:ModifyInstanceMetadataOptions

更新時間:Oct 07, 2023

Modifies the metadata of an Elastic Compute Service (ECS) instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes ModifyInstanceMetadataOptions

The operation that you want to perform. Set the value to ModifyInstanceMetadataOptions.

RegionId String Yes cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

InstanceId String No i-bp67acfmxaz****

The ID of the instance.

HttpEndpoint String Yes enabled

Specifies whether to enable the HTTP metadata endpoint on the instance. Valid values:

  • enabled
  • disabled

Default value: enabled.

Note For more information about instance metadata, see Overview of ECS instance metadata.
HttpTokens String No optional

Specifies whether to forcefully use the security-enhanced mode (IMDSv2) to access instance metadata. Valid values:

  • optional: does not forcefully use the security-enhanced mode (IMDSv2).
  • required: forcefully uses the security-enhanced mode (IMDSv2). After you set this parameter to required, you cannot access instance metadata in normal mode.

Default value: optional.

Note For more information about modes of accessing instance metadata, see Access mode of instance metadata.
HttpPutResponseHopLimit Integer No null
Note This parameter is in invitational preview and is not publicly available.
InstanceMetadataTags String No null
Note This parameter is in invitational preview and is not publicly available.

Response parameters

Parameter

Type

Example

Description

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

http(s)://ecs.aliyuncs.com/?Action=ModifyInstanceMetadataOptions
&RegionId=cn-hangzhou
&InstanceId=i-bp67acfmxaz****
&HttpEndpoint=enabled
&HttpTokens=required
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyInstanceMetadataOptionsResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyInstanceMetadataOptionsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP statue code

Error code

Error message

Description

400 InvalidHttpEndpoint.NotSupported The specified HttpEndpoint not supported, you can use enabled(default) or disabled. Invalid HttpEndpoint value. The valid values of this parameter are enabled and disabled. The default value is enabled.
400 InvalidHttpTokens.NotSupported The specified HttpTokens not supported, you can use optional(default) or required. Invalid HttpTokens value. The valid values of this parameter are optional and required. The default value is optional.
400 InvalidHttpPutResponseHopLimit.NotSupported The specified HttpPutResponseHopLimit not supported, more than 1 and less than 64 is reasonable. Invalid HttpPutResponseHopLimit value. The valid values of this parameter are 1 to 64.
404 InvalidInstanceId.NotFound The specified InstanceId is not found. The specified instance ID is not found.

For a list of error codes, see Service error codes.