turbot/alicloud
steampipe plugin install alicloud

Table: alicloud_ecs_autoscaling_group - Query Alibaba Cloud Elastic Compute Service Autoscaling Groups using SQL

Alibaba Cloud Elastic Compute Service (ECS) Autoscaling Groups are a collection of ECS instances that are created, managed, and released automatically according to the specified scaling rules and strategies. They help in maintaining application availability and improve cost-effectiveness by automatically adjusting the number of ECS instances according to the network traffic.

Table Usage Guide

The alicloud_ecs_autoscaling_group table provides insights into Autoscaling Groups within Alibaba Cloud Elastic Compute Service (ECS). As a system administrator or DevOps engineer, you can explore group-specific details through this table, including configuration, capacity, and detailed information about each autoscaling group. Use it to manage your ECS instances effectively, ensuring optimal resource allocation and cost-effectiveness.

Examples

Basic auto scaling group info

This example helps to understand the configuration and capacity details of an auto scaling group in Alibaba Cloud. It can be used to monitor and manage the scaling of resources, ensuring optimal performance and cost-effectiveness.

select
name,
load_balancer_ids,
default_cooldown,
active_capacity,
desired_capacity,
min_size,
max_size
from
alicloud_ecs_autoscaling_group;
select
name,
load_balancer_ids,
default_cooldown,
active_capacity,
desired_capacity,
min_size,
max_size
from
alicloud_ecs_autoscaling_group;

Autoscaling group instance details

Explore the specific details of instances within a particular autoscaling group. This can help in managing and optimizing resources by analyzing the health status, instance type, and other relevant details of each instance.

select
asg.name as autoscaling_group_name,
i.instance_type,
i.os_name_en,
i.private_ip_address,
i.public_ip_address,
ins_detail ->> 'InstanceId' as instance_id,
ins_detail ->> 'CreationType' as instance_creation_type,
ins_detail ->> 'HealthStatus' as health_status,
ins_detail ->> 'ScalingConfigurationId' as scaling_configuration_id,
ins_detail ->> 'ScalingGroupId' as scaling_group_id,
ins_detail -> 'LaunchTemplateId' as launch_template_id,
ins_detail -> 'LaunchTemplateVersion' as launch_template_version
from
alicloud_ecs_autoscaling_group as asg,
jsonb_array_elements(asg.scaling_instances) as ins_detail,
alicloud_ecs_instance as i
where
ins_detail ->> 'InstanceId' = i.instance_id
and asg.name = 'js_as_1';
select
asg.name as autoscaling_group_name,
i.instance_type,
i.os_name_en,
i.private_ip_address,
i.public_ip_address,
json_extract(ins_detail.value, '$.InstanceId') as instance_id,
json_extract(ins_detail.value, '$.CreationType') as instance_creation_type,
json_extract(ins_detail.value, '$.HealthStatus') as health_status,
json_extract(ins_detail.value, '$.ScalingConfigurationId') as scaling_configuration_id,
json_extract(ins_detail.value, '$.ScalingGroupId') as scaling_group_id,
json_extract(ins_detail.value, '$.LaunchTemplateId') as launch_template_id,
json_extract(ins_detail.value, '$.LaunchTemplateVersion') as launch_template_version
from
alicloud_ecs_autoscaling_group as asg,
json_each(asg.scaling_instances) as ins_detail,
alicloud_ecs_instance as i
where
json_extract(ins_detail.value, '$.InstanceId') = i.instance_id
and asg.name = 'js_as_1';

List of Autoscaling Group for which deletion protection is not enabled

Explore which autoscaling groups in your Alicloud ECS setup lack deletion protection. This is beneficial to identify potential risk areas and take necessary measures to prevent accidental deletions.

select
name,
scaling_group_id,
group_deletion_protection
from
alicloud_ecs_autoscaling_group
where
not group_deletion_protection;
select
name,
scaling_group_id,
group_deletion_protection
from
alicloud_ecs_autoscaling_group
where
group_deletion_protection = 0;

Schema for alicloud_ecs_autoscaling_group

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The Alicloud Account ID in which the resource is located.
active_capacitybigintThe number of ECS instances that have been added to the scaling group and are running properly.
active_scaling_configuration_idtextThe ID of the active scaling configuration in the scaling group.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
compensate_with_on_demandbooleanSpecifies whether to automatically create pay-as-you-go instances to meet the requirement for the number of ECS instances in the scaling group when the number of preemptible instances cannot be reached due to reasons such as cost or insufficient resources.
creation_timetimestamp with time zoneThe time when the scaling group was created.
db_instance_idsjsonbThe IDs of the ApsaraDB RDS instances that are associated with the scaling group.
default_cooldownbigintThe default cooldown period of the scaling group (in seconds).
desired_capacitybigintThe expected number of ECS instances in the scaling group. Auto Scaling automatically keeps the ECS instances at this number.
group_deletion_protectionbooleanIndicates whether scaling group deletion protection is enabled.
health_check_typetextThe health check mode of the scaling group.
launch_template_idtextThe ID of the launch template used by the scaling group.
launch_template_versiontextThe version of the launch template used by the scaling group.
life_cycle_statetextThe lifecycle status of the scaling group.
load_balancer_idsjsonbThe IDs of the SLB instances that are associated with the scaling group.
max_sizebigintThe maximum number of ECS instances in the scaling group.
min_sizebigintThe minimum number of ECS instances in the scaling group.
modification_timetimestamp with time zoneThe time when the scaling group was modified.
multi_az_policytextThe ECS instance scaling policy for a multi-zone scaling group.
nametext=A friendly name for the resource.
on_demand_base_capacitybigintThe minimum number of pay-as-you-go instances required in the scaling group. Valid values: 0 to 1000.
on_demand_percentage_above_base_capacitybigintThe percentage of pay-as-you-go instances to be created when instances are added to the scaling group.
pending_capacitybigintThe number of ECS instances that are being added to the scaling group, but are still being configured.
pending_wait_capacitybigintThe number of ECS instances that are in the pending state to be added in the scaling group.
protected_capacitybigintThe number of ECS instances that are in the protected state in the scaling group.
regiontextThe Alicloud region in which the resource is located.
removal_policiesjsonbDetails about policies for removing ECS instances from the scaling group.
removing_capacitybigintThe number of ECS instances that are being removed from the scaling group.
removing_wait_capacitybigintThe number of ECS instances that are in the pending state to be removed from the scaling group.
scaling_configurationsjsonbA list of scaling configurations.
scaling_group_idtext=An unique identifier for the resource.
scaling_instancesjsonbA list of ECS instances in a scaling group.
scaling_policytextSpecifies the reclaim policy of the scaling group.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
spot_instance_poolsbigintThe number of available instance types. Auto Scaling will create preemptible instances of multiple instance types available at the lowest cost. Valid values: 0 to 10.
spot_instance_remedybooleanSpecifies whether to supplement preemptible instances when the target capacity of preemptible instances is not fulfilled.
standby_capacitybigintThe number of instances that are in the standby state in the scaling group.
stopped_capacitybigintThe number of instances that are in the stopped state in the scaling group.
suspended_processesjsonbThe scaling activity that is suspended. If no scaling activity is suspended, the returned value is null.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags attached with the resource.
titletextTitle of the resource.
total_capacitybigintThe total number of ECS instances in the scaling group.
vpc_idtextThe ID of the VPC to which the scaling group belongs.
vserver_groupsjsonbDetails about backend server groups.
vswitch_idtextThe ID of the VSwitch that is associated with the scaling group.
vswitch_idsjsonbA collection of IDs of the VSwitches that are associated with the scaling group.

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_autoscaling_group