You can call this operation to query the user data of an ECS instance.

Description

  • The returned user data is encoded in Base64.
  • If the instance does not have any user data, a null value is returned.

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 DescribeUserData

The operation that you want to perform. For API requests using the HTTP and HTTPS methods, the Action parameter is required. Set the value to DescribeUserdata.

InstanceId String Yes i-instanceid1

The ID of the instance to be queried.

RegionId String Yes cn-hangzhou

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

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

RegionId String cn-hangzhou

The ID of the region.

InstanceId String i-instanceid1

The ID of the instance.

UserData String ZWNobyBoZWxsbyBlY3Mh

The user data of the instance.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action= DescribeUserdata
&RegionId=cn-shenzhen
&InstanceId=i-instance1
&<Common request parameters>

Sample success responses

XML format

<DescribeUserdataResponse>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
      <UserData>userdata1</UserData>
      <InstanceId>i-instance1</InstanceId>
      <RegionId>cn-shenzhen</RegionId>
</DescribeUserdataResponse>

JSON format

{
    "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
    " UserData ": "userdata1",
    " InstanceId ": "i-instance1",
    " RegionId": "cn-shenzhen"
}

Error codes

HTTP status code Error code Error message Description
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified InstanceId parameter does not exist.

For a list of error codes, visit the API Error Center.