Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi
alicloud.bastionhost.getHosts
Explore with Pulumi AI
This data source provides the Bastionhost Hosts of the current Alibaba Cloud user.
NOTE: Available in v1.135.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.bastionhost.getHosts({
    instanceId: "example_value",
    ids: [
        "1",
        "2",
    ],
});
export const bastionhostHostId1 = ids.then(ids => ids.hosts?.[0]?.id);
const nameRegex = alicloud.bastionhost.getHosts({
    instanceId: "example_value",
    nameRegex: "^my-Host",
});
export const bastionhostHostId2 = nameRegex.then(nameRegex => nameRegex.hosts?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.bastionhost.get_hosts(instance_id="example_value",
    ids=[
        "1",
        "2",
    ])
pulumi.export("bastionhostHostId1", ids.hosts[0].id)
name_regex = alicloud.bastionhost.get_hosts(instance_id="example_value",
    name_regex="^my-Host")
pulumi.export("bastionhostHostId2", name_regex.hosts[0].id)
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/bastionhost"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := bastionhost.GetHosts(ctx, &bastionhost.GetHostsArgs{
			InstanceId: "example_value",
			Ids: []string{
				"1",
				"2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostId1", ids.Hosts[0].Id)
		nameRegex, err := bastionhost.GetHosts(ctx, &bastionhost.GetHostsArgs{
			InstanceId: "example_value",
			NameRegex:  pulumi.StringRef("^my-Host"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostId2", nameRegex.Hosts[0].Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.BastionHost.GetHosts.Invoke(new()
    {
        InstanceId = "example_value",
        Ids = new[]
        {
            "1",
            "2",
        },
    });
    var nameRegex = AliCloud.BastionHost.GetHosts.Invoke(new()
    {
        InstanceId = "example_value",
        NameRegex = "^my-Host",
    });
    return new Dictionary<string, object?>
    {
        ["bastionhostHostId1"] = ids.Apply(getHostsResult => getHostsResult.Hosts[0]?.Id),
        ["bastionhostHostId2"] = nameRegex.Apply(getHostsResult => getHostsResult.Hosts[0]?.Id),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.bastionhost.BastionhostFunctions;
import com.pulumi.alicloud.bastionhost.inputs.GetHostsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var ids = BastionhostFunctions.getHosts(GetHostsArgs.builder()
            .instanceId("example_value")
            .ids(            
                "1",
                "2")
            .build());
        ctx.export("bastionhostHostId1", ids.applyValue(getHostsResult -> getHostsResult.hosts()[0].id()));
        final var nameRegex = BastionhostFunctions.getHosts(GetHostsArgs.builder()
            .instanceId("example_value")
            .nameRegex("^my-Host")
            .build());
        ctx.export("bastionhostHostId2", nameRegex.applyValue(getHostsResult -> getHostsResult.hosts()[0].id()));
    }
}
variables:
  ids:
    fn::invoke:
      function: alicloud:bastionhost:getHosts
      arguments:
        instanceId: example_value
        ids:
          - '1'
          - '2'
  nameRegex:
    fn::invoke:
      function: alicloud:bastionhost:getHosts
      arguments:
        instanceId: example_value
        nameRegex: ^my-Host
outputs:
  bastionhostHostId1: ${ids.hosts[0].id}
  bastionhostHostId2: ${nameRegex.hosts[0].id}
Using getHosts
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getHosts(args: GetHostsArgs, opts?: InvokeOptions): Promise<GetHostsResult>
function getHostsOutput(args: GetHostsOutputArgs, opts?: InvokeOptions): Output<GetHostsResult>def get_hosts(enable_details: Optional[bool] = None,
              host_address: Optional[str] = None,
              host_name: Optional[str] = None,
              ids: Optional[Sequence[str]] = None,
              instance_id: Optional[str] = None,
              name_regex: Optional[str] = None,
              os_type: Optional[str] = None,
              output_file: Optional[str] = None,
              source: Optional[str] = None,
              source_instance_id: Optional[str] = None,
              source_instance_state: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetHostsResult
def get_hosts_output(enable_details: Optional[pulumi.Input[bool]] = None,
              host_address: Optional[pulumi.Input[str]] = None,
              host_name: Optional[pulumi.Input[str]] = None,
              ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
              instance_id: Optional[pulumi.Input[str]] = None,
              name_regex: Optional[pulumi.Input[str]] = None,
              os_type: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              source: Optional[pulumi.Input[str]] = None,
              source_instance_id: Optional[pulumi.Input[str]] = None,
              source_instance_state: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetHostsResult]func GetHosts(ctx *Context, args *GetHostsArgs, opts ...InvokeOption) (*GetHostsResult, error)
func GetHostsOutput(ctx *Context, args *GetHostsOutputArgs, opts ...InvokeOption) GetHostsResultOutput> Note: This function is named GetHosts in the Go SDK.
public static class GetHosts 
{
    public static Task<GetHostsResult> InvokeAsync(GetHostsArgs args, InvokeOptions? opts = null)
    public static Output<GetHostsResult> Invoke(GetHostsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetHostsResult> getHosts(GetHostsArgs args, InvokeOptions options)
public static Output<GetHostsResult> getHosts(GetHostsArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:bastionhost/getHosts:getHosts
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Instance
Id string - Specify the new create a host where the Bastion host ID of.
 - Enable
Details bool - Default to 
false. Set it totruecan output more details about resource attributes. - Host
Address string - The host address.
 - Host
Name string - Specify the new create a host name of the supports up to 128 characters.
 - Ids List<string>
 - A list of Host IDs.
 - Name
Regex string - A regex string to filter results by Host name.
 - Os
Type string - Specify the new create the host's operating system. Valid values: Linux Windows.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Source string
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - Source
Instance stringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 - Source
Instance stringState  - The source instance state.
 
- Instance
Id string - Specify the new create a host where the Bastion host ID of.
 - Enable
Details bool - Default to 
false. Set it totruecan output more details about resource attributes. - Host
Address string - The host address.
 - Host
Name string - Specify the new create a host name of the supports up to 128 characters.
 - Ids []string
 - A list of Host IDs.
 - Name
Regex string - A regex string to filter results by Host name.
 - Os
Type string - Specify the new create the host's operating system. Valid values: Linux Windows.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Source string
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - Source
Instance stringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 - Source
Instance stringState  - The source instance state.
 
- instance
Id String - Specify the new create a host where the Bastion host ID of.
 - enable
Details Boolean - Default to 
false. Set it totruecan output more details about resource attributes. - host
Address String - The host address.
 - host
Name String - Specify the new create a host name of the supports up to 128 characters.
 - ids List<String>
 - A list of Host IDs.
 - name
Regex String - A regex string to filter results by Host name.
 - os
Type String - Specify the new create the host's operating system. Valid values: Linux Windows.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - source String
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source
Instance StringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 - source
Instance StringState  - The source instance state.
 
- instance
Id string - Specify the new create a host where the Bastion host ID of.
 - enable
Details boolean - Default to 
false. Set it totruecan output more details about resource attributes. - host
Address string - The host address.
 - host
Name string - Specify the new create a host name of the supports up to 128 characters.
 - ids string[]
 - A list of Host IDs.
 - name
Regex string - A regex string to filter results by Host name.
 - os
Type string - Specify the new create the host's operating system. Valid values: Linux Windows.
 - output
File string - File name where to save data source results (after running 
pulumi preview). - source string
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source
Instance stringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 - source
Instance stringState  - The source instance state.
 
- instance_
id str - Specify the new create a host where the Bastion host ID of.
 - enable_
details bool - Default to 
false. Set it totruecan output more details about resource attributes. - host_
address str - The host address.
 - host_
name str - Specify the new create a host name of the supports up to 128 characters.
 - ids Sequence[str]
 - A list of Host IDs.
 - name_
regex str - A regex string to filter results by Host name.
 - os_
type str - Specify the new create the host's operating system. Valid values: Linux Windows.
 - output_
file str - File name where to save data source results (after running 
pulumi preview). - source str
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source_
instance_ strid  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 - source_
instance_ strstate  - The source instance state.
 
- instance
Id String - Specify the new create a host where the Bastion host ID of.
 - enable
Details Boolean - Default to 
false. Set it totruecan output more details about resource attributes. - host
Address String - The host address.
 - host
Name String - Specify the new create a host name of the supports up to 128 characters.
 - ids List<String>
 - A list of Host IDs.
 - name
Regex String - A regex string to filter results by Host name.
 - os
Type String - Specify the new create the host's operating system. Valid values: Linux Windows.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - source String
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source
Instance StringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 - source
Instance StringState  - The source instance state.
 
getHosts Result
The following output properties are available:
- Hosts
List<Pulumi.
Ali Cloud. Bastion Host. Outputs. Get Hosts Host>  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids List<string>
 - Instance
Id string - Names List<string>
 - Enable
Details bool - Host
Address string - Host
Name string - Name
Regex string - Os
Type string - Output
File string - Source string
 - Source
Instance stringId  - Source
Instance stringState  
- Hosts
[]Get
Hosts Host  - Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids []string
 - Instance
Id string - Names []string
 - Enable
Details bool - Host
Address string - Host
Name string - Name
Regex string - Os
Type string - Output
File string - Source string
 - Source
Instance stringId  - Source
Instance stringState  
- hosts
List<Get
Hosts Host>  - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - instance
Id String - names List<String>
 - enable
Details Boolean - host
Address String - host
Name String - name
Regex String - os
Type String - output
File String - source String
 - source
Instance StringId  - source
Instance StringState  
- hosts
Get
Hosts Host[]  - id string
 - The provider-assigned unique ID for this managed resource.
 - ids string[]
 - instance
Id string - names string[]
 - enable
Details boolean - host
Address string - host
Name string - name
Regex string - os
Type string - output
File string - source string
 - source
Instance stringId  - source
Instance stringState  
- hosts
Sequence[Get
Hosts Host]  - id str
 - The provider-assigned unique ID for this managed resource.
 - ids Sequence[str]
 - instance_
id str - names Sequence[str]
 - enable_
details bool - host_
address str - host_
name str - name_
regex str - os_
type str - output_
file str - source str
 - source_
instance_ strid  - source_
instance_ strstate  
- hosts List<Property Map>
 - id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - instance
Id String - names List<String>
 - enable
Details Boolean - host
Address String - host
Name String - name
Regex String - os
Type String - output
File String - source String
 - source
Instance StringId  - source
Instance StringState  
Supporting Types
GetHostsHost  
- Active
Address stringType  - Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.
 - Comment string
 - Specify a host of notes, supports up to 500 characters.
 - Host
Id string - The host ID.
 - Host
Name string - Specify the new create a host name of the supports up to 128 characters.
 - Host
Private stringAddress  - Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.
 - Host
Public stringAddress  - Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.
 - Id string
 - The ID of the Host.
 - Instance
Id string - Specify the new create a host where the Bastion host ID of.
 - Os
Type string - Specify the new create the host's operating system. Valid values: Linux Windows.
 - Protocols
List<Pulumi.
Ali Cloud. Bastion Host. Inputs. Get Hosts Host Protocol>  - The host of the protocol information.
 - Source string
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - Source
Instance stringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 
- Active
Address stringType  - Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.
 - Comment string
 - Specify a host of notes, supports up to 500 characters.
 - Host
Id string - The host ID.
 - Host
Name string - Specify the new create a host name of the supports up to 128 characters.
 - Host
Private stringAddress  - Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.
 - Host
Public stringAddress  - Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.
 - Id string
 - The ID of the Host.
 - Instance
Id string - Specify the new create a host where the Bastion host ID of.
 - Os
Type string - Specify the new create the host's operating system. Valid values: Linux Windows.
 - Protocols
[]Get
Hosts Host Protocol  - The host of the protocol information.
 - Source string
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - Source
Instance stringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 
- active
Address StringType  - Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.
 - comment String
 - Specify a host of notes, supports up to 500 characters.
 - host
Id String - The host ID.
 - host
Name String - Specify the new create a host name of the supports up to 128 characters.
 - host
Private StringAddress  - Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.
 - host
Public StringAddress  - Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.
 - id String
 - The ID of the Host.
 - instance
Id String - Specify the new create a host where the Bastion host ID of.
 - os
Type String - Specify the new create the host's operating system. Valid values: Linux Windows.
 - protocols
List<Get
Hosts Host Protocol>  - The host of the protocol information.
 - source String
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source
Instance StringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 
- active
Address stringType  - Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.
 - comment string
 - Specify a host of notes, supports up to 500 characters.
 - host
Id string - The host ID.
 - host
Name string - Specify the new create a host name of the supports up to 128 characters.
 - host
Private stringAddress  - Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.
 - host
Public stringAddress  - Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.
 - id string
 - The ID of the Host.
 - instance
Id string - Specify the new create a host where the Bastion host ID of.
 - os
Type string - Specify the new create the host's operating system. Valid values: Linux Windows.
 - protocols
Get
Hosts Host Protocol[]  - The host of the protocol information.
 - source string
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source
Instance stringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 
- active_
address_ strtype  - Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.
 - comment str
 - Specify a host of notes, supports up to 500 characters.
 - host_
id str - The host ID.
 - host_
name str - Specify the new create a host name of the supports up to 128 characters.
 - host_
private_ straddress  - Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.
 - host_
public_ straddress  - Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.
 - id str
 - The ID of the Host.
 - instance_
id str - Specify the new create a host where the Bastion host ID of.
 - os_
type str - Specify the new create the host's operating system. Valid values: Linux Windows.
 - protocols
Sequence[Get
Hosts Host Protocol]  - The host of the protocol information.
 - source str
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source_
instance_ strid  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 
- active
Address StringType  - Specify the new create a host of address types. Valid values: Public: the IP address of a Public network Private: Private network address.
 - comment String
 - Specify a host of notes, supports up to 500 characters.
 - host
Id String - The host ID.
 - host
Name String - Specify the new create a host name of the supports up to 128 characters.
 - host
Private StringAddress  - Specify the new create a host of the private network address, it is possible to use the domain name or IP ADDRESS.
 - host
Public StringAddress  - Specify the new create a host of the IP address of a public network, it is possible to use the domain name or IP ADDRESS.
 - id String
 - The ID of the Host.
 - instance
Id String - Specify the new create a host where the Bastion host ID of.
 - os
Type String - Specify the new create the host's operating system. Valid values: Linux Windows.
 - protocols List<Property Map>
 - The host of the protocol information.
 - source String
 - Specify the new create a host of source. Valid values: Local: localhost Ecs:ECS instance Rds:RDS exclusive cluster host.
 - source
Instance StringId  - Specify the newly created ECS instance ID or dedicated cluster host ID.
 
GetHostsHostProtocol   
- Host
Finger stringPrint  - Host fingerprint information, it is possible to uniquely identify a host.
 - Port int
 - Host the service port of the RDS.
 - Protocol
Name string - The host uses the protocol name.
 
- Host
Finger stringPrint  - Host fingerprint information, it is possible to uniquely identify a host.
 - Port int
 - Host the service port of the RDS.
 - Protocol
Name string - The host uses the protocol name.
 
- host
Finger StringPrint  - Host fingerprint information, it is possible to uniquely identify a host.
 - port Integer
 - Host the service port of the RDS.
 - protocol
Name String - The host uses the protocol name.
 
- host
Finger stringPrint  - Host fingerprint information, it is possible to uniquely identify a host.
 - port number
 - Host the service port of the RDS.
 - protocol
Name string - The host uses the protocol name.
 
- host_
finger_ strprint  - Host fingerprint information, it is possible to uniquely identify a host.
 - port int
 - Host the service port of the RDS.
 - protocol_
name str - The host uses the protocol name.
 
- host
Finger StringPrint  - Host fingerprint information, it is possible to uniquely identify a host.
 - port Number
 - Host the service port of the RDS.
 - protocol
Name String - The host uses the protocol name.
 
Package Details
- Repository
 - Alibaba Cloud pulumi/pulumi-alicloud
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
alicloudTerraform Provider.