1. Packages
  2. Alicloud Provider
  3. API Docs
  4. ecs
  5. getInstances
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.ecs.getInstances

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    The Instances data source list ECS instance resources according to their ID, name regex, image id, status and other fields.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const instancesDs = alicloud.ecs.getInstances({
        nameRegex: "web_server",
        status: "Running",
    });
    export const firstInstanceId = instancesDs.then(instancesDs => instancesDs.instances?.[0]?.id);
    export const instanceIds = instancesDs.then(instancesDs => instancesDs.ids);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    instances_ds = alicloud.ecs.get_instances(name_regex="web_server",
        status="Running")
    pulumi.export("firstInstanceId", instances_ds.instances[0].id)
    pulumi.export("instanceIds", instances_ds.ids)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		instancesDs, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			NameRegex: pulumi.StringRef("web_server"),
    			Status:    pulumi.StringRef("Running"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstInstanceId", instancesDs.Instances[0].Id)
    		ctx.Export("instanceIds", instancesDs.Ids)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var instancesDs = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            NameRegex = "web_server",
            Status = "Running",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstInstanceId"] = instancesDs.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id),
            ["instanceIds"] = instancesDs.Apply(getInstancesResult => getInstancesResult.Ids),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 instancesDs = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .nameRegex("web_server")
                .status("Running")
                .build());
    
            ctx.export("firstInstanceId", instancesDs.applyValue(getInstancesResult -> getInstancesResult.instances()[0].id()));
            ctx.export("instanceIds", instancesDs.applyValue(getInstancesResult -> getInstancesResult.ids()));
        }
    }
    
    variables:
      instancesDs:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            nameRegex: web_server
            status: Running
    outputs:
      firstInstanceId: ${instancesDs.instances[0].id}
      instanceIds: ${instancesDs.ids}
    

    Using getInstances

    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 getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
    function getInstancesOutput(args: GetInstancesOutputArgs, opts?: InvokeOptions): Output<GetInstancesResult>
    def get_instances(availability_zone: Optional[str] = None,
                      enable_details: Optional[bool] = None,
                      ids: Optional[Sequence[str]] = None,
                      image_id: Optional[str] = None,
                      instance_name: Optional[str] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      page_number: Optional[int] = None,
                      page_size: Optional[int] = None,
                      ram_role_name: Optional[str] = None,
                      resource_group_id: Optional[str] = None,
                      status: Optional[str] = None,
                      tags: Optional[Mapping[str, str]] = None,
                      vpc_id: Optional[str] = None,
                      vswitch_id: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetInstancesResult
    def get_instances_output(availability_zone: Optional[pulumi.Input[str]] = None,
                      enable_details: Optional[pulumi.Input[bool]] = None,
                      ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                      image_id: Optional[pulumi.Input[str]] = None,
                      instance_name: Optional[pulumi.Input[str]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      output_file: Optional[pulumi.Input[str]] = None,
                      page_number: Optional[pulumi.Input[int]] = None,
                      page_size: Optional[pulumi.Input[int]] = None,
                      ram_role_name: Optional[pulumi.Input[str]] = None,
                      resource_group_id: Optional[pulumi.Input[str]] = None,
                      status: Optional[pulumi.Input[str]] = None,
                      tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                      vpc_id: Optional[pulumi.Input[str]] = None,
                      vswitch_id: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetInstancesResult]
    func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
    func GetInstancesOutput(ctx *Context, args *GetInstancesOutputArgs, opts ...InvokeOption) GetInstancesResultOutput

    > Note: This function is named GetInstances in the Go SDK.

    public static class GetInstances 
    {
        public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
        public static Output<GetInstancesResult> Invoke(GetInstancesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:ecs/getInstances:getInstances
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AvailabilityZone string
    Availability zone where instances are located.
    EnableDetails bool
    Default to true. If false, the attributes ram_role_name and disk_device_mappings will not be fetched and output.
    Ids List<string>
    A list of ECS instance IDs.
    ImageId string
    The image ID of some ECS instance used.
    InstanceName string
    The name of the instance. Fuzzy search with the asterisk (*) wildcard characters is supported.
    NameRegex string
    A regex string to filter results by instance name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PageNumber int
    PageSize int
    RamRoleName string
    The RAM role name which the instance attaches.
    ResourceGroupId string
    The ID of resource group which the instance belongs.
    Status string
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    Tags Dictionary<string, string>
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    title="Optional"> <span id="vpcid_csharp">

    VpcId string

    ID of the VPC linked to the instances.
    VswitchId string
    ID of the vSwitch linked to the instances.

    AvailabilityZone string
    Availability zone where instances are located.
    EnableDetails bool
    Default to true. If false, the attributes ram_role_name and disk_device_mappings will not be fetched and output.
    Ids []string
    A list of ECS instance IDs.
    ImageId string
    The image ID of some ECS instance used.
    InstanceName string
    The name of the instance. Fuzzy search with the asterisk (*) wildcard characters is supported.
    NameRegex string
    A regex string to filter results by instance name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PageNumber int
    PageSize int
    RamRoleName string
    The RAM role name which the instance attaches.
    ResourceGroupId string
    The ID of resource group which the instance belongs.
    Status string
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    Tags map[string]string
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    title="Optional"> <span id="vpcid_go">

    VpcId string

    ID of the VPC linked to the instances.
    VswitchId string
    ID of the vSwitch linked to the instances.

    availabilityZone String
    Availability zone where instances are located.
    enableDetails Boolean
    Default to true. If false, the attributes ram_role_name and disk_device_mappings will not be fetched and output.
    ids List<String>
    A list of ECS instance IDs.
    imageId String
    The image ID of some ECS instance used.
    instanceName String
    The name of the instance. Fuzzy search with the asterisk (*) wildcard characters is supported.
    nameRegex String
    A regex string to filter results by instance name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    pageNumber Integer
    pageSize Integer
    ramRoleName String
    The RAM role name which the instance attaches.
    resourceGroupId String
    The ID of resource group which the instance belongs.
    status String
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    tags Map<String,String>
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    title="Optional"> <span id="vpcid_java">

    vpcId String

    ID of the VPC linked to the instances.
    vswitchId String
    ID of the vSwitch linked to the instances.

    availabilityZone string
    Availability zone where instances are located.
    enableDetails boolean
    Default to true. If false, the attributes ram_role_name and disk_device_mappings will not be fetched and output.
    ids string[]
    A list of ECS instance IDs.
    imageId string
    The image ID of some ECS instance used.
    instanceName string
    The name of the instance. Fuzzy search with the asterisk (*) wildcard characters is supported.
    nameRegex string
    A regex string to filter results by instance name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    pageNumber number
    pageSize number
    ramRoleName string
    The RAM role name which the instance attaches.
    resourceGroupId string
    The ID of resource group which the instance belongs.
    status string
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    tags {[key: string]: string}
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    title="Optional"> <span id="vpcid_nodejs">

    vpcId string

    ID of the VPC linked to the instances.
    vswitchId string
    ID of the vSwitch linked to the instances.

    availability_zone str
    Availability zone where instances are located.
    enable_details bool
    Default to true. If false, the attributes ram_role_name and disk_device_mappings will not be fetched and output.
    ids Sequence[str]
    A list of ECS instance IDs.
    image_id str
    The image ID of some ECS instance used.
    instance_name str
    The name of the instance. Fuzzy search with the asterisk (*) wildcard characters is supported.
    name_regex str
    A regex string to filter results by instance name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    page_number int
    page_size int
    ram_role_name str
    The RAM role name which the instance attaches.
    resource_group_id str
    The ID of resource group which the instance belongs.
    status str
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    tags Mapping[str, str]
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    title="Optional"> <span id="vpc_id_python">

    vpc_id str

    ID of the VPC linked to the instances.
    vswitch_id str
    ID of the vSwitch linked to the instances.

    availabilityZone String
    Availability zone where instances are located.
    enableDetails Boolean
    Default to true. If false, the attributes ram_role_name and disk_device_mappings will not be fetched and output.
    ids List<String>
    A list of ECS instance IDs.
    imageId String
    The image ID of some ECS instance used.
    instanceName String
    The name of the instance. Fuzzy search with the asterisk (*) wildcard characters is supported.
    nameRegex String
    A regex string to filter results by instance name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    pageNumber Number
    pageSize Number
    ramRoleName String
    The RAM role name which the instance attaches.
    resourceGroupId String
    The ID of resource group which the instance belongs.
    status String
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    tags Map<String>
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    title="Optional"> <span id="vpcid_yaml">

    vpcId String

    ID of the VPC linked to the instances.
    vswitchId String
    ID of the vSwitch linked to the instances.

    getInstances Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of ECS instance IDs.
    Instances List<Pulumi.AliCloud.Ecs.Outputs.GetInstancesInstance>
    A list of instances. Each element contains the following attributes:
    Names List<string>
    A list of instances names.
    TotalCount int
    AvailabilityZone string
    Availability zone the instance belongs to.
    EnableDetails bool
    ImageId string
    Image ID the instance is using.
    InstanceName string
    NameRegex string
    OutputFile string
    PageNumber int
    PageSize int
    RamRoleName string
    The Ram role name.
    ResourceGroupId string
    The Id of resource group.
    Status string
    Instance current status.
    Tags Dictionary<string, string>
    A map of tags assigned to the ECS instance.
    VpcId string
    ID of the VPC the instance belongs to.
    VswitchId string
    ID of the vSwitch the instance belongs to.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of ECS instance IDs.
    Instances []GetInstancesInstance
    A list of instances. Each element contains the following attributes:
    Names []string
    A list of instances names.
    TotalCount int
    AvailabilityZone string
    Availability zone the instance belongs to.
    EnableDetails bool
    ImageId string
    Image ID the instance is using.
    InstanceName string
    NameRegex string
    OutputFile string
    PageNumber int
    PageSize int
    RamRoleName string
    The Ram role name.
    ResourceGroupId string
    The Id of resource group.
    Status string
    Instance current status.
    Tags map[string]string
    A map of tags assigned to the ECS instance.
    VpcId string
    ID of the VPC the instance belongs to.
    VswitchId string
    ID of the vSwitch the instance belongs to.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of ECS instance IDs.
    instances List<GetInstancesInstance>
    A list of instances. Each element contains the following attributes:
    names List<String>
    A list of instances names.
    totalCount Integer
    availabilityZone String
    Availability zone the instance belongs to.
    enableDetails Boolean
    imageId String
    Image ID the instance is using.
    instanceName String
    nameRegex String
    outputFile String
    pageNumber Integer
    pageSize Integer
    ramRoleName String
    The Ram role name.
    resourceGroupId String
    The Id of resource group.
    status String
    Instance current status.
    tags Map<String,String>
    A map of tags assigned to the ECS instance.
    vpcId String
    ID of the VPC the instance belongs to.
    vswitchId String
    ID of the vSwitch the instance belongs to.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of ECS instance IDs.
    instances GetInstancesInstance[]
    A list of instances. Each element contains the following attributes:
    names string[]
    A list of instances names.
    totalCount number
    availabilityZone string
    Availability zone the instance belongs to.
    enableDetails boolean
    imageId string
    Image ID the instance is using.
    instanceName string
    nameRegex string
    outputFile string
    pageNumber number
    pageSize number
    ramRoleName string
    The Ram role name.
    resourceGroupId string
    The Id of resource group.
    status string
    Instance current status.
    tags {[key: string]: string}
    A map of tags assigned to the ECS instance.
    vpcId string
    ID of the VPC the instance belongs to.
    vswitchId string
    ID of the vSwitch the instance belongs to.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of ECS instance IDs.
    instances Sequence[GetInstancesInstance]
    A list of instances. Each element contains the following attributes:
    names Sequence[str]
    A list of instances names.
    total_count int
    availability_zone str
    Availability zone the instance belongs to.
    enable_details bool
    image_id str
    Image ID the instance is using.
    instance_name str
    name_regex str
    output_file str
    page_number int
    page_size int
    ram_role_name str
    The Ram role name.
    resource_group_id str
    The Id of resource group.
    status str
    Instance current status.
    tags Mapping[str, str]
    A map of tags assigned to the ECS instance.
    vpc_id str
    ID of the VPC the instance belongs to.
    vswitch_id str
    ID of the vSwitch the instance belongs to.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of ECS instance IDs.
    instances List<Property Map>
    A list of instances. Each element contains the following attributes:
    names List<String>
    A list of instances names.
    totalCount Number
    availabilityZone String
    Availability zone the instance belongs to.
    enableDetails Boolean
    imageId String
    Image ID the instance is using.
    instanceName String
    nameRegex String
    outputFile String
    pageNumber Number
    pageSize Number
    ramRoleName String
    The Ram role name.
    resourceGroupId String
    The Id of resource group.
    status String
    Instance current status.
    tags Map<String>
    A map of tags assigned to the ECS instance.
    vpcId String
    ID of the VPC the instance belongs to.
    vswitchId String
    ID of the vSwitch the instance belongs to.

    Supporting Types

    GetInstancesInstance

    AvailabilityZone string
    Availability zone where instances are located.
    CreationTime string
    Instance creation time.
    Description string
    Instance description.
    DiskDeviceMappings List<Pulumi.AliCloud.Ecs.Inputs.GetInstancesInstanceDiskDeviceMapping>
    Description of the attached disks.
    Eip string
    EIP address the VPC instance is using.
    Id string
    ID of the instance.
    ImageId string
    The image ID of some ECS instance used.
    InstanceChargeType string
    Instance charge type.
    InstanceType string
    Instance type.
    InternetChargeType string
    Instance network charge type.
    InternetMaxBandwidthOut int
    Max output bandwidth for internet.
    KeyName string
    Key pair the instance is using.
    Name string
    Instance name.
    PrivateIp string
    Instance private IP address.
    PublicIp string
    Instance public IP address.
    RamRoleName string
    The RAM role name which the instance attaches.
    RegionId string
    Region ID the instance belongs to.
    ResourceGroupId string
    The ID of resource group which the instance belongs.
    SecurityGroups List<string>
    List of security group IDs the instance belongs to.
    SpotStrategy string
    Spot strategy the instance is using.
    Status string
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    VpcId string
    ID of the VPC linked to the instances.
    VswitchId string
    ID of the vSwitch linked to the instances.
    Tags Dictionary<string, string>
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    AvailabilityZone string
    Availability zone where instances are located.
    CreationTime string
    Instance creation time.
    Description string
    Instance description.
    DiskDeviceMappings []GetInstancesInstanceDiskDeviceMapping
    Description of the attached disks.
    Eip string
    EIP address the VPC instance is using.
    Id string
    ID of the instance.
    ImageId string
    The image ID of some ECS instance used.
    InstanceChargeType string
    Instance charge type.
    InstanceType string
    Instance type.
    InternetChargeType string
    Instance network charge type.
    InternetMaxBandwidthOut int
    Max output bandwidth for internet.
    KeyName string
    Key pair the instance is using.
    Name string
    Instance name.
    PrivateIp string
    Instance private IP address.
    PublicIp string
    Instance public IP address.
    RamRoleName string
    The RAM role name which the instance attaches.
    RegionId string
    Region ID the instance belongs to.
    ResourceGroupId string
    The ID of resource group which the instance belongs.
    SecurityGroups []string
    List of security group IDs the instance belongs to.
    SpotStrategy string
    Spot strategy the instance is using.
    Status string
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    VpcId string
    ID of the VPC linked to the instances.
    VswitchId string
    ID of the vSwitch linked to the instances.
    Tags map[string]string
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    availabilityZone String
    Availability zone where instances are located.
    creationTime String
    Instance creation time.
    description String
    Instance description.
    diskDeviceMappings List<GetInstancesInstanceDiskDeviceMapping>
    Description of the attached disks.
    eip String
    EIP address the VPC instance is using.
    id String
    ID of the instance.
    imageId String
    The image ID of some ECS instance used.
    instanceChargeType String
    Instance charge type.
    instanceType String
    Instance type.
    internetChargeType String
    Instance network charge type.
    internetMaxBandwidthOut Integer
    Max output bandwidth for internet.
    keyName String
    Key pair the instance is using.
    name String
    Instance name.
    privateIp String
    Instance private IP address.
    publicIp String
    Instance public IP address.
    ramRoleName String
    The RAM role name which the instance attaches.
    regionId String
    Region ID the instance belongs to.
    resourceGroupId String
    The ID of resource group which the instance belongs.
    securityGroups List<String>
    List of security group IDs the instance belongs to.
    spotStrategy String
    Spot strategy the instance is using.
    status String
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    vpcId String
    ID of the VPC linked to the instances.
    vswitchId String
    ID of the vSwitch linked to the instances.
    tags Map<String,String>
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    availabilityZone string
    Availability zone where instances are located.
    creationTime string
    Instance creation time.
    description string
    Instance description.
    diskDeviceMappings GetInstancesInstanceDiskDeviceMapping[]
    Description of the attached disks.
    eip string
    EIP address the VPC instance is using.
    id string
    ID of the instance.
    imageId string
    The image ID of some ECS instance used.
    instanceChargeType string
    Instance charge type.
    instanceType string
    Instance type.
    internetChargeType string
    Instance network charge type.
    internetMaxBandwidthOut number
    Max output bandwidth for internet.
    keyName string
    Key pair the instance is using.
    name string
    Instance name.
    privateIp string
    Instance private IP address.
    publicIp string
    Instance public IP address.
    ramRoleName string
    The RAM role name which the instance attaches.
    regionId string
    Region ID the instance belongs to.
    resourceGroupId string
    The ID of resource group which the instance belongs.
    securityGroups string[]
    List of security group IDs the instance belongs to.
    spotStrategy string
    Spot strategy the instance is using.
    status string
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    vpcId string
    ID of the VPC linked to the instances.
    vswitchId string
    ID of the vSwitch linked to the instances.
    tags {[key: string]: string}
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    availability_zone str
    Availability zone where instances are located.
    creation_time str
    Instance creation time.
    description str
    Instance description.
    disk_device_mappings Sequence[GetInstancesInstanceDiskDeviceMapping]
    Description of the attached disks.
    eip str
    EIP address the VPC instance is using.
    id str
    ID of the instance.
    image_id str
    The image ID of some ECS instance used.
    instance_charge_type str
    Instance charge type.
    instance_type str
    Instance type.
    internet_charge_type str
    Instance network charge type.
    internet_max_bandwidth_out int
    Max output bandwidth for internet.
    key_name str
    Key pair the instance is using.
    name str
    Instance name.
    private_ip str
    Instance private IP address.
    public_ip str
    Instance public IP address.
    ram_role_name str
    The RAM role name which the instance attaches.
    region_id str
    Region ID the instance belongs to.
    resource_group_id str
    The ID of resource group which the instance belongs.
    security_groups Sequence[str]
    List of security group IDs the instance belongs to.
    spot_strategy str
    Spot strategy the instance is using.
    status str
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    vpc_id str
    ID of the VPC linked to the instances.
    vswitch_id str
    ID of the vSwitch linked to the instances.
    tags Mapping[str, str]
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    
    availabilityZone String
    Availability zone where instances are located.
    creationTime String
    Instance creation time.
    description String
    Instance description.
    diskDeviceMappings List<Property Map>
    Description of the attached disks.
    eip String
    EIP address the VPC instance is using.
    id String
    ID of the instance.
    imageId String
    The image ID of some ECS instance used.
    instanceChargeType String
    Instance charge type.
    instanceType String
    Instance type.
    internetChargeType String
    Instance network charge type.
    internetMaxBandwidthOut Number
    Max output bandwidth for internet.
    keyName String
    Key pair the instance is using.
    name String
    Instance name.
    privateIp String
    Instance private IP address.
    publicIp String
    Instance public IP address.
    ramRoleName String
    The RAM role name which the instance attaches.
    regionId String
    Region ID the instance belongs to.
    resourceGroupId String
    The ID of resource group which the instance belongs.
    securityGroups List<String>
    List of security group IDs the instance belongs to.
    spotStrategy String
    Spot strategy the instance is using.
    status String
    Instance status. Valid values: "Creating", "Starting", "Running", "Stopping" and "Stopped". If undefined, all statuses are considered.
    vpcId String
    ID of the VPC linked to the instances.
    vswitchId String
    ID of the vSwitch linked to the instances.
    tags Map<String>
    A map of tags assigned to the ECS instances. It must be in the format:

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    

    const taggedInstances = alicloud.ecs.getInstances({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });

    import pulumi
    import pulumi_alicloud as alicloud
    
    tagged_instances = alicloud.ecs.get_instances(tags={
        "tagKey1": "tagValue1",
        "tagKey2": "tagValue2",
    })
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var taggedInstances = AliCloud.Ecs.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "tagKey1", "tagValue1" },
                { "tagKey2", "tagValue2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.GetInstances(ctx, &ecs.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"tagKey1": "tagValue1",
    				"tagKey2": "tagValue2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ecs.EcsFunctions;
    import com.pulumi.alicloud.ecs.inputs.GetInstancesArgs;
    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 taggedInstances = EcsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("tagKey1", "tagValue1"),
                    Map.entry("tagKey2", "tagValue2")
                ))
                .build());
    
        }
    }
    
    variables:
      taggedInstances:
        fn::invoke:
          Function: alicloud:ecs:getInstances
          Arguments:
            tags:
              tagKey1: tagValue1
              tagKey2: tagValue2
    

    GetInstancesInstanceDiskDeviceMapping

    Category string
    Cloud disk category.
    Device string
    Device information of the created disk: such as /dev/xvdb.
    DiskId string
    The ID of the Disk.
    DiskName string
    The name of the Disk.
    Size int
    Size of the created disk.
    Type string
    Cloud disk type: system disk or data disk.
    Category string
    Cloud disk category.
    Device string
    Device information of the created disk: such as /dev/xvdb.
    DiskId string
    The ID of the Disk.
    DiskName string
    The name of the Disk.
    Size int
    Size of the created disk.
    Type string
    Cloud disk type: system disk or data disk.
    category String
    Cloud disk category.
    device String
    Device information of the created disk: such as /dev/xvdb.
    diskId String
    The ID of the Disk.
    diskName String
    The name of the Disk.
    size Integer
    Size of the created disk.
    type String
    Cloud disk type: system disk or data disk.
    category string
    Cloud disk category.
    device string
    Device information of the created disk: such as /dev/xvdb.
    diskId string
    The ID of the Disk.
    diskName string
    The name of the Disk.
    size number
    Size of the created disk.
    type string
    Cloud disk type: system disk or data disk.
    category str
    Cloud disk category.
    device str
    Device information of the created disk: such as /dev/xvdb.
    disk_id str
    The ID of the Disk.
    disk_name str
    The name of the Disk.
    size int
    Size of the created disk.
    type str
    Cloud disk type: system disk or data disk.
    category String
    Cloud disk category.
    device String
    Device information of the created disk: such as /dev/xvdb.
    diskId String
    The ID of the Disk.
    diskName String
    The name of the Disk.
    size Number
    Size of the created disk.
    type String
    Cloud disk type: system disk or data disk.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi