GetInstances

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

Example Usage

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; }
}

Coming soon!

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)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const instancesDs = pulumi.output(alicloud.ecs.getInstances({
    nameRegex: "web_server",
    status: "Running",
}, { async: true }));

export const firstInstanceId = instancesDs.instances[0].id;
export const instanceIds = instancesDs.ids!;

Using GetInstances

function getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
function  get_instances(availability_zone=None, ids=None, image_id=None, name_regex=None, output_file=None, ram_role_name=None, resource_group_id=None, status=None, tags=None, vpc_id=None, vswitch_id=None, opts=None)
func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
public static class GetInstances {
    public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

AvailabilityZone string

Availability zone where instances are located.

Ids List<string>

A list of ECS instance IDs.

ImageId string

The image ID of some ECS instance used.

NameRegex string

A regex string to filter results by instance name.

OutputFile string
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, object>

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
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.

Ids []string

A list of ECS instance IDs.

ImageId string

The image ID of some ECS instance used.

NameRegex string

A regex string to filter results by instance name.

OutputFile string
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]interface{}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
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.

ids string[]

A list of ECS instance IDs.

imageId string

The image ID of some ECS instance used.

nameRegex string

A regex string to filter results by instance name.

outputFile string
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]: any}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
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.

ids List[str]

A list of ECS instance IDs.

image_id str

The image ID of some ECS instance used.

name_regex str

A regex string to filter results by instance name.

output_file str
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 Dict[str, Any]

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
vpc_id str

ID of the VPC linked to the instances.

vswitch_id str

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.

AvailabilityZone string

Availability zone the instance belongs to.

ImageId string

Image ID the instance is using.

NameRegex string
OutputFile string
RamRoleName string

The Ram role name.

ResourceGroupId string

The Id of resource group.

Status string

Instance current status.

Tags Dictionary<string, object>

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.

AvailabilityZone string

Availability zone the instance belongs to.

ImageId string

Image ID the instance is using.

NameRegex string
OutputFile string
RamRoleName string

The Ram role name.

ResourceGroupId string

The Id of resource group.

Status string

Instance current status.

Tags map[string]interface{}

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.

availabilityZone string

Availability zone the instance belongs to.

imageId string

Image ID the instance is using.

nameRegex string
outputFile string
ramRoleName string

The Ram role name.

resourceGroupId string

The Id of resource group.

status string

Instance current status.

tags {[key: string]: any}

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 List[str]

A list of ECS instance IDs.

instances List[GetInstancesInstance]

A list of instances. Each element contains the following attributes:

names List[str]

A list of instances names.

availability_zone str

Availability zone the instance belongs to.

image_id str

Image ID the instance is using.

name_regex str
output_file str
ram_role_name str

The Ram role name.

resource_group_id str

The Id of resource group.

status str

Instance current status.

tags Dict[str, Any]

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.

Supporting Types

GetInstancesInstance

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

AvailabilityZone string

Availability zone where instances are located.

CreationTime string

Instance creation time.

Description string

Instance description.

DiskDeviceMappings List<Pulumi.AliCloud.Ecs.Inputs.GetInstancesInstanceDiskDeviceMappingArgs>

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, object>

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
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]interface{}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
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]: any}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
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 List[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 float

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.

regionId str

Region ID the instance belongs to.

resource_group_id str

The Id of resource group which the instance belongs.

security_groups List[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 Dict[str, Any]

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getInstances" "taggedInstances" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}

GetInstancesInstanceDiskDeviceMapping

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Category string

Cloud disk category.

Device string

Device information of the created disk: such as /dev/xvdb.

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.

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.

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.

size float

Size of the created disk.

type str

Cloud disk type: system disk or data disk.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.