Table: alicloud_ecs_instance
An ECS instance is a virtual machine that contains basic computing components such as the vCPU, memory, operating system, network, and disk.
Examples
Basic Instance Info
Assess the elements within your Alibaba Cloud ECS instances to gain insights into their operational status, type, and network details. This can help in managing resources, ensuring optimal performance, and identifying potential issues.
select instance_id, name, arn, status, instance_type, os_name_en, public_ip_address, private_ip_address, zonefrom alicloud_ecs_instance;
select instance_id, name, arn, status, instance_type, os_name_en, public_ip_address, private_ip_address, zonefrom alicloud_ecs_instance;
List stopped instances that you are still being charged for
This query is useful for identifying instances that are in a stopped state but still incurring charges. It helps in managing costs by pinpointing areas where resources are not being optimally used.
select instance_id, name, status, stopped_mode, instance_type, os_name_en, public_ip_address, private_ip_address, zonefrom alicloud_ecs_instancewhere stopped_mode = 'KeepCharging';
select instance_id, name, status, stopped_mode, instance_type, os_name_en, public_ip_address, private_ip_address, zonefrom alicloud_ecs_instancewhere stopped_mode = 'KeepCharging';
List linux instances
Identify instances where the operating system is Linux. This is useful for managing resources or troubleshooting specific issues related to Linux-based instances.
select instance_id, name, instance_type, os_name_en, zonefrom alicloud_ecs_instancewhere os_type = 'linux';
select instance_id, name, instance_type, os_name_en, zonefrom alicloud_ecs_instancewhere os_type = 'linux';
Instance count in each zone
Determine the distribution of instances across various zones to balance and optimize resource allocation. This aids in planning infrastructure decisions and mitigating risk by avoiding over-reliance on a single zone.
select zone as az, count(*)from alicloud_ecs_instancegroup by zone;
select zone as az, count(*)from alicloud_ecs_instancegroup by zone;
Count the number of instances by instance type
Assess the distribution of different instance types within your Alicloud Elastic Compute Service to better understand your resource usage. This can aid in optimizing your allocation strategy and managing costs more effectively.
select instance_type, count(instance_type) as countfrom alicloud_ecs_instancegroup by instance_type;
select instance_type, count(instance_type) as countfrom alicloud_ecs_instancegroup by instance_type;
List of instances without application tag key
Identify instances where the 'application' tag key is missing, which could indicate a lack of necessary metadata for proper resource management and classification. This can be crucial for maintaining organized and efficient infrastructure in a cloud environment.
select instance_id, tagsfrom alicloud_ecs_instancewhere tags ->> 'application' is null;
select instance_id, tagsfrom alicloud_ecs_instancewhere json_extract(tags, '$.application') is null;
List of ECS instances provisioned with undesired(for example ecs.t5-lc2m1.nano and ecs.t6-c2m1.large is desired) instance type(s)
Identify instances where ECS instances are provisioned with undesired types, helping to manage resources and maintain preferred configurations.
select instance_type, count(*) as countfrom alicloud_ecs_instancewhere instance_type not in ('ecs.t5-lc2m1.nano', 'ecs.t6-c2m1.large')group by instance_type;
select instance_type, count(*) as countfrom alicloud_ecs_instancewhere instance_type not in ('ecs.t5-lc2m1.nano', 'ecs.t6-c2m1.large')group by instance_type;
List ECS instances having deletion protection safety feature disabled
Determine the areas in which Elastic Compute Service (ECS) instances might be at risk due to disabled deletion protection. This query is useful to identify potential vulnerabilities and ensure data safety.
select instance_id, deletion_protectionfrom alicloud_ecs_instancewhere not deletion_protection;
select instance_id, deletion_protectionfrom alicloud_ecs_instancewhere deletion_protection = 0;
Query examples
- ecs_autoscaling_groups_for_ecs_instance
- ecs_disks_for_ecs_instance
- ecs_images_for_ecs_instance
- ecs_instance_1_year_count
- ecs_instance_24_hours_count
- ecs_instance_30_90_days_count
- ecs_instance_30_days_count
- ecs_instance_90_365_days_count
- ecs_instance_by_account
- ecs_instance_by_creation_month
- ecs_instance_by_deletion_protection
- ecs_instance_by_io_optimized
- ecs_instance_by_network_type
- ecs_instance_by_os_type
- ecs_instance_by_public_ip
- ecs_instance_by_region
- ecs_instance_by_type
- ecs_instance_count
- ecs_instance_cpu_cores
- ecs_instance_dedicated_host
- ecs_instance_deletion_protection_disabled_count
- ecs_instance_input
- ecs_instance_io_optimized
- ecs_instance_io_optimized_count
- ecs_instance_network_interfaces
- ecs_instance_os_type
- ecs_instance_overview
- ecs_instance_public_access
- ecs_instance_public_access_count
- ecs_instance_public_access_table
- ecs_instance_public_instance_count
- ecs_instance_security_groups
- ecs_instance_tags
- ecs_instance_total_cores
- ecs_instance_total_cores_count
- ecs_instance_type
- ecs_instances_for_ecs_disk
- ecs_instances_for_ecs_security_group
- ecs_instances_for_ecs_snapshot
- ecs_instances_for_ram_role
- ecs_instances_for_vpc
- ecs_instances_for_vpc_vswitch
- ecs_network_interfaces_for_ecs_instance
- ecs_security_group_egress_rule_sankey
- ecs_security_group_ingress_rule_sankey
- ecs_security_groups_for_ecs_instance
- ecs_snapshots_for_ecs_instance
- ram_roles_for_ecs_instance
- vpc_eips_for_ecs_instance
- vpc_vpcs_for_ecs_instance
- vpc_vswitch_association
- vpc_vswitches_for_ecs_instance
Schema for alicloud_ecs_instance
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Alicloud Account ID in which the resource is located. |
activation_id | text | The activation Id if the instance. | |
agent_version | text | The agent version. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
arn | text | The Alibaba Cloud Resource Name (ARN) of the ECS instance. | |
auto_release_time | timestamp with time zone | The automatic release time of the pay-as-you-go instance. | |
billing_method | text | = | The billing method for network usage. |
connected | boolean | Indicates whether the instance is connected.. | |
cpu | bigint | The number of vCPUs. | |
cpu_options_core_count | bigint | The number of CPU cores. | |
cpu_options_numa | text | The number of threads allocated. | |
cpu_options_threads_per_core | bigint | The number of threads per core. | |
creation_time | timestamp with time zone | The time when the instance was created. | |
credit_specification | text | The performance mode of the burstable instance. | |
dedicated_host_cluster_id | text | The cluster ID of the dedicated host. | |
dedicated_host_id | text | The ID of the dedicated host. | |
dedicated_host_name | text | The name of the dedicated host. | |
dedicated_instance_affinity | text | Indicates whether the instance on a dedicated host is associated with the dedicated host. | |
dedicated_instance_tenancy | text | Indicates whether the instance is hosted on a dedicated host. | |
deletion_protection | boolean | Indicates whether you can use the ECS console or call the DeleteInstance operation to release the instance. | |
deployment_set_group_no | bigint | The group No. of the instance in a deployment set when the deployment set is used to distribute instances across multiple physical machines. | |
deployment_set_id | text | The ID of the deployment set. | |
description | text | The description of the instance. | |
device_available | boolean | !=, = | Indicates whether data disks can be attached to the instance. |
ecs_capacity_reservation_id | text | The ID of the capacity reservation. | |
ecs_capacity_reservation_preference | text | The preference of the ECS capacity reservation. | |
eip_address | jsonb | The information of the EIP associated with the instance. | |
expired_time | timestamp with time zone | The expiration time of the instance. | |
family | text | = | The instance family of the instance. |
gpu_amount | bigint | The number of GPUs for the instance type. | |
gpu_spec | text | The category of GPUs for the instance type. | |
host_name | text | The hostname of the instance. | |
hpc_cluster_id | text | The ID of the HPC cluster to which the instance belongs. | |
image_id | text | = | The ID of the image that the instance is running. |
inner_ip_address | jsonb | The internal IP addresses of classic network-type instances. This parameter takes effect when InstanceNetworkType is set to classic. The value can be a JSON array that consists of up to 100 IP addresses. Separate multiple IP addresses with commas (,). | |
instance_id | text | = | The ID of the instance. |
instance_network_type | text | = | The network type of the instance. |
instance_type | text | = | The type of the instance. |
internet_charge_type | text | = | The billing method for network usage. Valid values:PayByBandwidth,PayByTraffic |
internet_max_bandwidth_in | bigint | The maximum inbound bandwidth from the Internet (in Mbit/s). | |
internet_max_bandwidth_out | bigint | The maximum outbound bandwidth to the Internet (in Mbit/s). | |
invocation_count | bigint | The count of instance invocation | |
io_optimized | boolean | !=, = | Specifies whether the instance is I/O optimized. |
is_spot | boolean | Indicates whether the instance is a spot instance, or not. | |
key_pair_name | text | The name of the SSH key pair for the instance. | |
last_invoked_time | timestamp with time zone | The time when the instance is last invoked. | |
local_storage_amount | bigint | The number of local disks attached to the instance. | |
local_storage_capacity | bigint | The capacity of local disks attached to the instance. | |
memory | bigint | The memory size of the instance (in MiB). | |
metadata_options | jsonb | The collection of metadata options. | |
name | text | = | The name of the instance. |
network_interfaces | jsonb | Details about the ENIs bound to the instance. | |
network_type | text | The type of the network. | |
operation_locks | jsonb | Details about the reasons why the instance was locked. | |
os_name | text | The name of the operating system for the instance. | |
os_name_en | text | The English name of the operating system for the instance. | |
os_type | text | The type of the operating system. Possible values are: windows and linux. | |
os_version | text | The version of the operating system. | |
private_ip_address | jsonb | The private IP addresses of instances. | |
public_ip_address | jsonb | The public IP addresses of instances. | |
ram_role | jsonb | RAM role attached to the instance. | |
rdma_ip_address | jsonb | The RDMA IP address of HPC instance. | |
recyclable | boolean | Indicates whether the instance can be recycled. | |
region | text | The Alicloud region in which the resource is located. | |
registration_time | timestamp with time zone | The time when the instance is registered. | |
resource_group_id | text | = | The ID of the resource group to which the instance belongs. |
sale_cycle | text | The billing cycle of the instance. | |
security_group_ids | jsonb | The IDs of security groups to which the instance belongs. | |
serial_number | text | The serial number of the instance. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
spot_duration | bigint | The protection period of the preemptible instance (in hours). | |
spot_price_limit | double precision | The maximum hourly price for the instance. | |
spot_strategy | text | The preemption policy for the pay-as-you-go instance. | |
start_time | timestamp with time zone | The start time of the bidding mode for the preemptible instance. | |
status | text | = | The status of the instance. Possible values are: Pending, Running, Starting, Stopping, and Stopped |
stopped_mode | text | Indicates whether the instance continues to be billed after it is stopped. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | A list of tags attached with the resource. | |
title | text | Title of the resource. | |
vlan_id | text | The VLAN ID of the instance. | |
vpc_attributes | jsonb | The VPC attributes of the instance. | |
vpc_id | text | = | The type of the instance. |
zone | text | = | The zone in which the instance resides. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- alicloud
You can pass the configuration to the command with the --config
argument:
steampipe_export_alicloud --config '<your_config>' alicloud_ecs_instance