Show / Hide Table of Contents

Class GetInstances

Inheritance
System.Object
GetInstances
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.AliCloud.Ecs
Assembly: Pulumi.AliCloud.dll
Syntax
public static class GetInstances

Methods

View Source

InvokeAsync(GetInstancesArgs, InvokeOptions)

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

{{% examples %}}

Example Usage

{{% example %}}

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var instancesDs = Output.Create(AliCloud.Ecs.GetInstances.InvokeAsync(new AliCloud.Ecs.GetInstancesArgs
    {
        NameRegex = "web_server",
        Status = "Running",
    }));
    this.FirstInstanceId = instancesDs.Apply(instancesDs => instancesDs.Instances[0].Id);
    this.InstanceIds = instancesDs.Apply(instancesDs => instancesDs.Ids);
}

[Output("firstInstanceId")]
public Output<string> FirstInstanceId { get; set; }
[Output("instanceIds")]
public Output<string> InstanceIds { get; set; }
}

{{% /example %}} {{% /examples %}}

Declaration
public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args = null, InvokeOptions options = null)
Parameters
Type Name Description
GetInstancesArgs args
InvokeOptions options
Returns
Type Description
System.Threading.Tasks.Task<GetInstancesResult>
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.