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:
- Availability
Zone string Availability zone where instances are located.
- Ids List<string>
A list of ECS instance IDs.
- Image
Id string The image ID of some ECS instance used.
- Name
Regex string A regex string to filter results by instance name.
- Output
File string - Ram
Role stringName The RAM role name which the instance attaches.
- Resource
Group stringId 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.
- 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" } }- Vpc
Id string ID of the VPC linked to the instances.
- Vswitch
Id string ID of the VSwitch linked to the instances.
- Availability
Zone string Availability zone where instances are located.
- Ids []string
A list of ECS instance IDs.
- Image
Id string The image ID of some ECS instance used.
- Name
Regex string A regex string to filter results by instance name.
- Output
File string - Ram
Role stringName The RAM role name which the instance attaches.
- Resource
Group stringId 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.
- 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" } }- Vpc
Id string ID of the VPC linked to the instances.
- Vswitch
Id string ID of the VSwitch linked to the instances.
- availability
Zone string Availability zone where instances are located.
- ids string[]
A list of ECS instance IDs.
- image
Id string The image ID of some ECS instance used.
- name
Regex string A regex string to filter results by instance name.
- output
File string - ram
Role stringName The RAM role name which the instance attaches.
- resource
Group stringId 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.
- {[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" } }- vpc
Id string ID of the VPC linked to the instances.
- vswitch
Id 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_ strname The RAM role name which the instance attaches.
- resource_
group_ strid 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.
- 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.
Ali Cloud. Ecs. Outputs. Get Instances Instance> A list of instances. Each element contains the following attributes:
- Names List<string>
A list of instances names.
- Availability
Zone string Availability zone the instance belongs to.
- Image
Id string Image ID the instance is using.
- Name
Regex string - Output
File string - Ram
Role stringName The Ram role name.
- Resource
Group stringId The Id of resource group.
- Status string
Instance current status.
- Dictionary<string, object>
A map of tags assigned to the ECS instance.
- Vpc
Id string ID of the VPC the instance belongs to.
- Vswitch
Id 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
[]Get
Instances Instance A list of instances. Each element contains the following attributes:
- Names []string
A list of instances names.
- Availability
Zone string Availability zone the instance belongs to.
- Image
Id string Image ID the instance is using.
- Name
Regex string - Output
File string - Ram
Role stringName The Ram role name.
- Resource
Group stringId The Id of resource group.
- Status string
Instance current status.
- map[string]interface{}
A map of tags assigned to the ECS instance.
- Vpc
Id string ID of the VPC the instance belongs to.
- Vswitch
Id 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
Get
Instances Instance[] A list of instances. Each element contains the following attributes:
- names string[]
A list of instances names.
- availability
Zone string Availability zone the instance belongs to.
- image
Id string Image ID the instance is using.
- name
Regex string - output
File string - ram
Role stringName The Ram role name.
- resource
Group stringId The Id of resource group.
- status string
Instance current status.
- {[key: string]: any}
A map of tags assigned to the ECS instance.
- vpc
Id string ID of the VPC the instance belongs to.
- vswitch
Id 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[Get
Instances Instance] 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_ strname The Ram role name.
- resource_
group_ strid The Id of resource group.
- status str
Instance current status.
- 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.
- Availability
Zone string Availability zone where instances are located.
- Creation
Time string Instance creation time.
- Description string
Instance description.
- Disk
Device List<Pulumi.Mappings Ali Cloud. Ecs. Inputs. Get Instances Instance Disk Device Mapping Args> Description of the attached disks.
- Eip string
EIP address the VPC instance is using.
- Id string
ID of the instance.
- Image
Id string The image ID of some ECS instance used.
- Instance
Charge stringType Instance charge type.
- Instance
Type string Instance type.
- Internet
Charge stringType Instance network charge type.
- Internet
Max intBandwidth Out Max output bandwidth for internet.
- Key
Name string Key pair the instance is using.
- Name string
Instance name.
- Private
Ip string Instance private IP address.
- Public
Ip string Instance public IP address.
- Ram
Role stringName The RAM role name which the instance attaches.
- Region
Id string Region ID the instance belongs to.
- Resource
Group stringId The Id of resource group which the instance belongs.
- Security
Groups List<string> List of security group IDs the instance belongs to.
- Spot
Strategy 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.
- Vpc
Id string ID of the VPC linked to the instances.
- Vswitch
Id string ID of the VSwitch linked to the instances.
- 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" } }
- Availability
Zone string Availability zone where instances are located.
- Creation
Time string Instance creation time.
- Description string
Instance description.
- Disk
Device []GetMappings Instances Instance Disk Device Mapping Description of the attached disks.
- Eip string
EIP address the VPC instance is using.
- Id string
ID of the instance.
- Image
Id string The image ID of some ECS instance used.
- Instance
Charge stringType Instance charge type.
- Instance
Type string Instance type.
- Internet
Charge stringType Instance network charge type.
- Internet
Max intBandwidth Out Max output bandwidth for internet.
- Key
Name string Key pair the instance is using.
- Name string
Instance name.
- Private
Ip string Instance private IP address.
- Public
Ip string Instance public IP address.
- Ram
Role stringName The RAM role name which the instance attaches.
- Region
Id string Region ID the instance belongs to.
- Resource
Group stringId The Id of resource group which the instance belongs.
- Security
Groups []string List of security group IDs the instance belongs to.
- Spot
Strategy 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.
- Vpc
Id string ID of the VPC linked to the instances.
- Vswitch
Id string ID of the VSwitch linked to the instances.
- 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" } }
- availability
Zone string Availability zone where instances are located.
- creation
Time string Instance creation time.
- description string
Instance description.
- disk
Device GetMappings Instances Instance Disk Device Mapping[] Description of the attached disks.
- eip string
EIP address the VPC instance is using.
- id string
ID of the instance.
- image
Id string The image ID of some ECS instance used.
- instance
Charge stringType Instance charge type.
- instance
Type string Instance type.
- internet
Charge stringType Instance network charge type.
- internet
Max numberBandwidth Out Max output bandwidth for internet.
- key
Name string Key pair the instance is using.
- name string
Instance name.
- private
Ip string Instance private IP address.
- public
Ip string Instance public IP address.
- ram
Role stringName The RAM role name which the instance attaches.
- region
Id string Region ID the instance belongs to.
- resource
Group stringId The Id of resource group which the instance belongs.
- security
Groups string[] List of security group IDs the instance belongs to.
- spot
Strategy 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.
- vpc
Id string ID of the VPC linked to the instances.
- vswitch
Id string ID of the VSwitch linked to the instances.
- {[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_ List[Getmappings Instances Instance Disk Device Mapping] 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_ strtype Instance charge type.
- instance_
type str Instance type.
- internet_
charge_ strtype Instance network charge type.
- internet_
max_ floatbandwidth_ out 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_ strname The RAM role name which the instance attaches.
- region
Id str Region ID the instance belongs to.
- resource_
group_ strid 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.
- 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.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.