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_sizefrom alicloud_ecs_autoscaling_group;
select name, load_balancer_ids, default_cooldown, active_capacity, desired_capacity, min_size, max_sizefrom 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_versionfrom alicloud_ecs_autoscaling_group as asg, jsonb_array_elements(asg.scaling_instances) as ins_detail, alicloud_ecs_instance as iwhere 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_versionfrom alicloud_ecs_autoscaling_group as asg, json_each(asg.scaling_instances) as ins_detail, alicloud_ecs_instance as iwhere 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_protectionfrom alicloud_ecs_autoscaling_groupwhere not group_deletion_protection;
select name, scaling_group_id, group_deletion_protectionfrom alicloud_ecs_autoscaling_groupwhere group_deletion_protection = 0;
Query examples
Schema for alicloud_ecs_autoscaling_group
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Alicloud Account ID in which the resource is located. |
active_capacity | bigint | The number of ECS instances that have been added to the scaling group and are running properly. | |
active_scaling_configuration_id | text | The ID of the active scaling configuration in the scaling group. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
compensate_with_on_demand | boolean | Specifies 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_time | timestamp with time zone | The time when the scaling group was created. | |
db_instance_ids | jsonb | The IDs of the ApsaraDB RDS instances that are associated with the scaling group. | |
default_cooldown | bigint | The default cooldown period of the scaling group (in seconds). | |
desired_capacity | bigint | The expected number of ECS instances in the scaling group. Auto Scaling automatically keeps the ECS instances at this number. | |
group_deletion_protection | boolean | Indicates whether scaling group deletion protection is enabled. | |
health_check_type | text | The health check mode of the scaling group. | |
launch_template_id | text | The ID of the launch template used by the scaling group. | |
launch_template_version | text | The version of the launch template used by the scaling group. | |
life_cycle_state | text | The lifecycle status of the scaling group. | |
load_balancer_ids | jsonb | The IDs of the SLB instances that are associated with the scaling group. | |
max_size | bigint | The maximum number of ECS instances in the scaling group. | |
min_size | bigint | The minimum number of ECS instances in the scaling group. | |
modification_time | timestamp with time zone | The time when the scaling group was modified. | |
multi_az_policy | text | The ECS instance scaling policy for a multi-zone scaling group. | |
name | text | = | A friendly name for the resource. |
on_demand_base_capacity | bigint | The minimum number of pay-as-you-go instances required in the scaling group. Valid values: 0 to 1000. | |
on_demand_percentage_above_base_capacity | bigint | The percentage of pay-as-you-go instances to be created when instances are added to the scaling group. | |
pending_capacity | bigint | The number of ECS instances that are being added to the scaling group, but are still being configured. | |
pending_wait_capacity | bigint | The number of ECS instances that are in the pending state to be added in the scaling group. | |
protected_capacity | bigint | The number of ECS instances that are in the protected state in the scaling group. | |
region | text | The Alicloud region in which the resource is located. | |
removal_policies | jsonb | Details about policies for removing ECS instances from the scaling group. | |
removing_capacity | bigint | The number of ECS instances that are being removed from the scaling group. | |
removing_wait_capacity | bigint | The number of ECS instances that are in the pending state to be removed from the scaling group. | |
scaling_configurations | jsonb | A list of scaling configurations. | |
scaling_group_id | text | = | An unique identifier for the resource. |
scaling_instances | jsonb | A list of ECS instances in a scaling group. | |
scaling_policy | text | Specifies the reclaim policy of the scaling group. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
spot_instance_pools | bigint | The 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_remedy | boolean | Specifies whether to supplement preemptible instances when the target capacity of preemptible instances is not fulfilled. | |
standby_capacity | bigint | The number of instances that are in the standby state in the scaling group. | |
stopped_capacity | bigint | The number of instances that are in the stopped state in the scaling group. | |
suspended_processes | jsonb | The scaling activity that is suspended. If no scaling activity is suspended, the returned value is null. | |
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. | |
total_capacity | bigint | The total number of ECS instances in the scaling group. | |
vpc_id | text | The ID of the VPC to which the scaling group belongs. | |
vserver_groups | jsonb | Details about backend server groups. | |
vswitch_id | text | The ID of the VSwitch that is associated with the scaling group. | |
vswitch_ids | jsonb | A 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