Queries the user data of an Elastic Compute Service (ECS) instance.

Description

  • The returned user data is encoded in Base64.
  • If the instance does not have user data configured, an empty result 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. Set the value to DescribeUserdata.

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 Yes i-bp14bnftyqhxg9ij****

The ID of the instance.

Response parameters

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

The ID of the request.

InstanceId String i-bp14bnftyqhxg9ij****

The ID of the instance.

UserData String ZWNobyBoZWxsbyBlY321ABC

The user data of the instance.

RegionId String cn-hangzhou

The region ID of the instance.

Examples

Sample requests

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

Sample success responses

XML format

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

<DescribeUserdataResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
    <UserData>ZWNobyBoZWxsbyBlY321ABC</UserData>
    <InstanceId>i-bp14bnftyqhxg9ij****</InstanceId>
    <RegionId>cn-shenzhen</RegionId>
</DescribeUserdataResponse>

JSON format

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

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  " UserData " : "ZWNobyBoZWxsbyBlY321ABC",
  " InstanceId " : "i-bp14bnftyqhxg9ij****",
  " 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 is invalid.

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