DATASOURCE::ECS::Instances is used to query the details of Elastic Compute Service (ECS) instances.

Syntax

{
  "Type": "DATASOURCE::ECS::Instances",
  "Properties": {
    "InnerIpAddresses": List,
    "ResourceGroupId": String,
    "PrivateIpAddresses": List,
    "InstanceChargeType": String,
    "InstanceTypeFamily": String,
    "InstanceNetworkType": String,
    "Filters": List,
    "AdditionalAttributes": List,
    "ImageId": String,
    "PublicIpAddresses": List,
    "RdmaIpAddresses": String,
    "InstanceIds": List,
    "InstanceType": String,
    "Ipv6Address": List,
    "Tags": List,
    "Status": String,
    "KeyPairName": String,
    "IoOptimized": Boolean,
    "ZoneId": String,
    "InstanceId": String,
    "HpcClusterId": String,
    "VSwitchId": String,
    "SecurityGroupId": String,
    "InternetChargeType": String,
    "InstanceName": String,
    "EipAddresses": List,
    "VpcId": String
  }
}

Properties

Property Type Required Editable Description Constraint
InnerIpAddresses List No Yes The internal IP addresses of the instance in the classic network. This property takes effect when the InstanceNetworkType property is set to classic.

You can specify up to 100 IP addresses. Separate multiple IP addresses with commas (,).

Example: ["10.1.1.1", "10.1.2.1", … "10.1.10.1"].

ResourceGroupId String No Yes The ID of the resource group to which the instance belongs. None.
PrivateIpAddresses List No Yes The private IP addresses of the instance in the virtual private cloud (VPC). This property takes effect when the InstanceNetworkType property is set to vpc.

You can specify up to 100 IP addresses. Separate multiple IP addresses with commas (,).

Example: ["172.16.1.1", "172.16.2.1", … "172.16.10.1"].

InstanceChargeType String No Yes The billing method of the instance. Valid values:
  • PostPaid: pay-as-you-go
  • PrePaid: subscription
InstanceTypeFamily String No Yes The instance family of the instance. None.
InstanceNetworkType String No Yes The network type of the instance. Valid values:
  • classic: classic network
  • vpc: VPC
Filters List No Yes The filters that are used to query resources. For more information, see Filters properties.
AdditionalAttributes List No Yes Other properties of the instance. Valid values:
  • META_OPTIONS: the instance metadata
  • DDH_CLUSTER: the dedicated host cluster
  • NETWORK_PRIMARY_ENI_IP: the secondary IP address of the primary elastic network interface (ENI)
ImageId String No Yes The ID of the image. None.
PublicIpAddresses List No Yes The public IP addresses of the instance. You can specify up to 100 IP addresses. Separate multiple IP addresses with commas (,).

Example: ["192.0.2.0", "192.0.2.1**", … "192.0.2.10"].

RdmaIpAddresses String No Yes The remote direct memory access (RDMA) IP addresses of the instance that belongs to a High Performance Computing (HPC) cluster. None.
InstanceIds List No Yes The IDs of the instances. You can specify up to 100 IDs. Separate multiple IDs with commas (,).
InstanceType String No Yes The instance type of the instance. None.
Ipv6Address List No Yes The IPv6 addresses of the ENI. You can specify up to 100 IP addresses. Separate multiple IP addresses with commas (,).
Tags List No Yes The tags of the instance. You can specify up to 20 tags.

For more information, see Tags properties.

Status String No Yes The state of the instance. Valid values:
  • Pending: The instance is being created.
  • Running: The instance is running.
  • Starting: The instance is being started.
  • Stopping: The instance is being stopped.
  • Stopped: The instance is stopped.
KeyPairName String No Yes The name of the SSH key pair for the instance. None.
IoOptimized Boolean No Yes Indicates whether the instance is an I/O optimized instance. Valid values:
  • true
  • false
ZoneId String No Yes The ID of the zone. None.
InstanceId String No Yes The ID of the instance. None.
HpcClusterId String No Yes The ID of the HPC cluster to which the instance belongs. None.
VSwitchId String No Yes The ID of the vSwitch. None.
SecurityGroupId String No Yes The ID of the security group. None.
InternetChargeType String No Yes The metering method for network usage. Valid values:
  • PayByBandwidth: pay-by-bandwidth
  • PayByTraffic: pay-by-data-transfer
InstanceName String No Yes The name of the instance. None.
EipAddresses List No Yes The elastic IP addresses (EIPs) of the instance. This property takes effect when the InstanceNetworkType property is set to vpc.

You can specify up to 100 IP addresses. Separate multiple IP addresses with commas (,).

VpcId String No Yes The ID of the VPC. None.

Filters syntax

"Filters": [
  {
    "Value": String,
    "Key": String
  }
]

Filters properties

Property Type Required Editable Description Constraint
Key String Yes No The key of the filter. Set the value to CreationStartTime. The value specifies the beginning of the time range during which resources are created.

You can set the Key property to CreationStartTime and set the Value property to a point in time to query resources that are created after the point in time.

Value String No No The value of the filter. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC+0.

Tags syntax

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags properties

Property Type Required Editable Description Constraint
Key String Yes No The key of the tag. None.
Value String No No The value of the tag. None.

Return values (Fn::GetAtt)

  • InstanceIds: the IDs of the instances.
  • Instances: details of the instances.
Property Type Description Constraint
InstanceIds List The IDs of the instances. None.
Instances List Details of the instances. None.
SerialNumber String The serial number of the instance. None.
Status String The state of the instance. None.
DeploymentSetId String The ID of the deployment set. None.
SpotStrategy String The bidding policy for the instance. Valid values:
  • NoSpot: The instance is a regular pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is a preemptible instance for which you specify the maximum hourly price.
  • SpotAsPriceGo: The instance is a preemptible instance whose price is based on the market price at the time of purchase. The market price can be equal to the price of a pay-as-you-go instance.
DeviceAvailable Boolean Indicates whether data disks can be attached to the instance. Valid values:
  • true
  • false
Description String The description of the instance. None.
InstanceNetworkType String The network type of the instance. Valid values:
  • classic: classic network
  • vpc: VPC
InstanceName String The name of the instance. None.
OSNameEn String The English name of the OS that is used by the instance. None.
SpotPriceLimit Number The maximum hourly price of the instance. This property takes effect when the SpotStrategy property is set to SpotWithPriceLimit.
Memory Number The memory size. Unit: MiB.
OSName String The Chinese name of the OS that is used by the instance. None.
ImageId String The ID of the image. None.
GPUSpec String The GPU model with which the instance type is equipped. None.
StoppedMode String Indicates whether the system implements billing after the instance is stopped. Valid values:
  • KeepCharging: standard mode. The system implements billing after the instance is stopped, and resources of the instance are retained.
  • StopCharging: economical mode. The system does not implement billing after the instance is stopped, and resources of the instance, such as the vCPUs, memory, and public IP address are released.
  • Not-applicable: Economical mode is not applicable to the instance.
GPUAmount Number The number of GPUs with which the instance type is equipped. None.
HostName String The hostname of the instance. None.
InstanceId String The ID of the instance. None.
InternetMaxBandwidthOut Number The maximum outbound public bandwidth. Unit: Mbit/s.
InternetMaxBandwidthIn Number The maximum inbound public bandwidth. Unit: Mbit/s.
InstanceType String The instance type of the instance. None.
InstanceChargeType String The billing method of the instance. Valid values:
  • PrePaid: subscription
  • PostPaid: pay-as-you-go
IoOptimized Boolean Indicates whether the instance is an I/O optimized instance. Valid values:
  • true
  • false
Cpu Number The number of vCPUs. None.
ResourceGroupId String The ID of the resource group to which the instance belongs. None.
InternetChargeType String The metering method for network usage. Valid values:
  • PayByBandwidth: pay-by-bandwidth
  • PayByTraffic: pay-by-data-transfer
ZoneId String The ID of the zone. None.
InstanceTypeFamily String The instance family of the instance. None.
OSType String The OS type of the instance. Valid values:
  • windows
  • linux
NetworkInterfaces List The ENIs that are attached to the instance. None.
Tags List The tags of the instance. None.
SecurityGroupIds List The IDs of the security groups to which the instance belongs. None.
PublicIpAddress List The public IP addresses of the instance. None.
InnerIpAddress List The private IP addresses of the instance in the classic network. None.
EipAddress List The EIPs of the instance. None.
DedicatedHostAttribute List The properties of the dedicated host. None.
EcsCapacityReservationAttr List The properties of capacity reservation that is configured for the instance. None.
DedicatedInstanceAttribute List The properties of the instance on the dedicated host. None.

Examples

  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "InstanceIds": {
          "Type": "Json",
          "Default": [
            "i-bp17f03tk0f4bi86***"
          ]
        }
      },
      "Resources": {
        "NetworkInterfaces": {
          "Type": "DATASOURCE::ECS::Instances",
          "Properties": {
            "InstanceIds": {
              "Ref": "InstanceIds"
            }
          }
        }
      },
      "Outputs": {
        "Images": {
          "Value": {
            "Fn::GetAtt": [
              "NetworkInterfaces",
              "InstanceIds"
            ]
          }
        },
        "ImageIds": {
          "Value": {
            "Fn::GetAtt": [
              "NetworkInterfaces",
              "Instances"
            ]
          }
        }
      }
    }
  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      InstanceIds:
        Type: Json
        Default:
          - i-bp17f03tk0f4bi86***
    Resources:
      NetworkInterfaces:
        Type: DATASOURCE::ECS::Instances
        Properties:
          InstanceIds:
            Ref: InstanceIds
    Outputs:
      Images:
        Value:
          Fn::GetAtt:
            - NetworkInterfaces
            - InstanceIds
      ImageIds:
        Value:
          Fn::GetAtt:
            - NetworkInterfaces
            - Instances