turbot/alicloud
steampipe plugin install alicloud

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,
region
from
alicloud_ecs_launch_template;
select
name,
launch_template_id,
default_version_number,
latest_version_number,
region
from
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_id
from
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_id
from
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_instance
from
alicloud_ecs_launch_template,
jsonb_array_elements(
latest_version_details -> 'LaunchTemplateData' -> 'DataDisks' -> 'DataDisk'
) as disk_config
where
(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_instance
from
alicloud_ecs_launch_template,
json_each(
latest_version_details,
'$.LaunchTemplateData.DataDisks.DataDisk'
) as disk_config
where
json_extract(disk_config.value, '$.Encrypted') = 'true'
and json_extract(disk_config.value, '$.DeleteWithInstance') = 'true';

Schema for alicloud_ecs_launch_template

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextThe Alicloud Account ID in which the resource is located.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
create_timetimestamp with time zoneThe time when the launch template was created.
created_bytextSpecifies the creator of the launch template.
default_version_numberbigintThe default version number of the launch template.
latest_version_detailsjsonbDescribes the configuration of latest launch template version.
latest_version_numberbigintThe latest version number of the launch template.
launch_template_idtext=An unique identifier for the resource.
modified_timetimestamp with time zoneThe time when the launch template was modified.
nametextA friendly name for the resource.
regiontextThe Alicloud region in which the resource is located.
resource_group_idtextThe ID of the resource group to which the launch template belongs.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags attached with the resource.
titletextTitle 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