Table: alicloud_ecs_launch_template - Query Alibaba Cloud ECS Launch Templates using SQL
Alibaba Cloud Elastic Compute Service (ECS) Launch Templates provide a way to save instance launch configurations, allowing for the rapid deployment of instances with pre-defined settings. These templates can include instance type, image, security group, and other instance-related parameters. Utilizing a launch template can streamline instance deployment and ensure consistency across instances.
Table Usage Guide
The alicloud_ecs_launch_template
table provides insights into ECS Launch Templates within Alibaba Cloud Elastic Compute Service. As a DevOps engineer, explore template-specific details through this table, including instance configurations, security settings, and associated metadata. Utilize it to uncover information about templates, such as those with specific instance types or security groups, and to streamline and standardize your instance deployment process.
Examples
Basic info
Explore the different launch templates available on Alibaba Cloud's Elastic Compute Service (ECS). This allows you to assess the default and latest version numbers of each template, aiding in version control and regional deployment strategies.
select name, launch_template_id, default_version_number, latest_version_number, regionfrom alicloud_ecs_launch_template;
select name, launch_template_id, default_version_number, latest_version_number, regionfrom alicloud_ecs_launch_template;
Get the current template version's configuration
Explore the latest configurations of your virtual server templates, including details like instance type, charge type, image ID, and associated security groups. This can help in understanding your current setup and planning for any necessary changes or updates.
select name, latest_version_details -> 'LaunchTemplateData' ->> 'InstanceName' as instance_name, latest_version_details -> 'LaunchTemplateData' ->> 'InstanceType' as instance_type, latest_version_details -> 'LaunchTemplateData' ->> 'InternetChargeType' as instance_charge_type, latest_version_details -> 'LaunchTemplateData' ->> 'ImageId' as image_id, latest_version_details -> 'LaunchTemplateData' ->> 'VpcId' as vpc_id, latest_version_details -> 'LaunchTemplateData' ->> 'VSwitchId' as v_switch_id, latest_version_details -> 'LaunchTemplateData' ->> 'SecurityGroupId' as security_group_idfrom alicloud_ecs_launch_template;
select name, json_extract( latest_version_details, '$.LaunchTemplateData.InstanceName' ) as instance_name, json_extract( latest_version_details, '$.LaunchTemplateData.InstanceType' ) as instance_type, json_extract( latest_version_details, '$.LaunchTemplateData.InternetChargeType' ) as instance_charge_type, json_extract( latest_version_details, '$.LaunchTemplateData.ImageId' ) as image_id, json_extract( latest_version_details, '$.LaunchTemplateData.VpcId' ) as vpc_id, json_extract( latest_version_details, '$.LaunchTemplateData.VSwitchId' ) as v_switch_id, json_extract( latest_version_details, '$.LaunchTemplateData.SecurityGroupId' ) as security_group_idfrom alicloud_ecs_launch_template;
List templates that use encrypted storage disk
Determine the areas in which encrypted storage disks are utilized within templates, focusing on those that are configured to be deleted along with the instance. This is useful for understanding your security measures and potential data loss risks.
select name, disk_config ->> 'Encrypted' as disk_encryption, disk_config ->> 'DeleteWithInstance' as delete_with_instancefrom alicloud_ecs_launch_template, jsonb_array_elements( latest_version_details -> 'LaunchTemplateData' -> 'DataDisks' -> 'DataDisk' ) as disk_configwhere (disk_config ->> 'Encrypted') :: boolean and (disk_config ->> 'DeleteWithInstance') :: boolean;
select name, json_extract(disk_config.value, '$.Encrypted') as disk_encryption, json_extract(disk_config.value, '$.DeleteWithInstance') as delete_with_instancefrom alicloud_ecs_launch_template, json_each( latest_version_details, '$.LaunchTemplateData.DataDisks.DataDisk' ) as disk_configwhere json_extract(disk_config.value, '$.Encrypted') = 'true' and json_extract(disk_config.value, '$.DeleteWithInstance') = 'true';
Schema for alicloud_ecs_launch_template
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Alicloud Account ID in which the resource is located. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
create_time | timestamp with time zone | The time when the launch template was created. | |
created_by | text | Specifies the creator of the launch template. | |
default_version_number | bigint | The default version number of the launch template. | |
latest_version_details | jsonb | Describes the configuration of latest launch template version. | |
latest_version_number | bigint | The latest version number of the launch template. | |
launch_template_id | text | = | An unique identifier for the resource. |
modified_time | timestamp with time zone | The time when the launch template was modified. | |
name | text | A friendly name for the resource. | |
region | text | The Alicloud region in which the resource is located. | |
resource_group_id | text | The ID of the resource group to which the launch template belongs. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
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. |
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_launch_template