All Products
Search
Document Center

Bastionhost:ListHostAccounts

Last Updated:Jul 29, 2025

Queries a list of host accounts.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that support authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

yundun-bastionhost:ListHostAccounts

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The ID of the Bastionhost instance.

Note

You can call the DescribeInstances operation to obtain the instance ID.

bastionhost-cn-st220aw****

RegionId

string

No

The region ID of the Bastionhost instance.

Note

For more information about the mapping between region IDs and region names, see Regions and zones.

cn-hangzhou

HostId

string

Yes

The ID of the host for which you want to query host accounts.

Note

You can call the ListHosts operation to obtain the host ID.

1

PageNumber

string

No

The number of the page to return. Default value: 1.

1

PageSize

string

No

The number of entries to return on each page.
The maximum value of the PageSize parameter is 100. The default value is 20. If you leave this parameter empty, 20 entries are returned on each page.

Note

We recommend that you do not leave this parameter empty.

20

HostAccountName

string

No

The name of the host account that you want to query. The name can be up to 128 characters in length. This parameter supports only term queries.

abc

ProtocolName

string

No

The protocol of the host account that you want to query.
Valid values:

  • SSH

  • RDP

SSH

HostIds

string

No

The array of host IDs for which you want to query host accounts.

Note

This parameter takes effect only when the value of the HostId parameter is 0. If the HostId parameter is specified with a non-zero value, this parameter is ignored.

["2","3"]

Response parameters

Parameter

Type

Description

Example

object

TotalCount

integer

The total number of returned host accounts.

1

RequestId

string

The ID of the request.

EC9BF0F4-8983-491A-BC8C-1B4DD94976DE

HostAccounts

array<object>

The list of the returned host accounts.

object

ProtocolName

string

The protocol of the host account.
Valid values:

  • SSH

  • RDP

SSH

PrivateKeyFingerprint

string

The fingerprint of the private key of the host account.

fe:ca:37:42:30:00:9d:95:e6:73:e5:b0:32:0a:**:**

HostId

string

The ID of the host.

1

HostAccountId

string

The ID of the host account.

1

HostAccountName

string

The name of the host account.

abc

RotationMode

string

The password change mode of the account.

  • Privileged: The password is changed using a privileged account.

  • Self: The password is changed without using a privileged account.

Note

This parameter is available only for Bastionhost instances of V3.2.47 or later.

Privileged

HostShareKeyName

string

The name of the shared key of the host.

name

HasPassword

boolean

Indicates whether a password is set for the host account.
Valid values:

  • true: A password is set.

  • false: No password is set.

true

HostShareKeyId

string

The ID of the shared key of the host.

1

PrivilegeType

string

The permission type of the account.

  • Privileged: privileged account

  • Normal: regular account

Note

This parameter is available only for Bastionhost instances of V3.2.47 or later.

Normal

Examples

Success response

JSON format

{
  "TotalCount": 1,
  "RequestId": "EC9BF0F4-8983-491A-BC8C-1B4DD94976DE",
  "HostAccounts": [
    {
      "ProtocolName": "SSH",
      "PrivateKeyFingerprint": "fe:ca:37:42:30:00:9d:95:e6:73:e5:b0:32:0a:**:**",
      "HostId": "1",
      "HostAccountId": "1",
      "HostAccountName": "abc",
      "RotationMode": "Privileged",
      "HostShareKeyName": "name",
      "HasPassword": true,
      "HostShareKeyId": "1",
      "PrivilegeType": "Normal"
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The argument is invalid. The argument is invalid.
500 InternalError An unknown error occurred. An unknown error occurred.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.