Table: alicloud_ecs_snapshot - Query Alibaba Cloud ECS Snapshots using SQL
Elastic Compute Service (ECS) Snapshots in Alibaba Cloud are a point-in-time copy of ECS disk data. Snapshots are used for data backup and restoration, disaster recovery, and migration across regions and zones. They provide a cost-effective and efficient way to create copies of data at a specific point in time.
Table Usage Guide
The alicloud_ecs_snapshot
table provides insights into ECS Snapshots within Alibaba Cloud Elastic Compute Service (ECS). As a DevOps engineer, explore snapshot-specific details through this table, including snapshot status, creation time, and associated metadata. Utilize it to uncover information about snapshots, such as those that are unused, the relationships between snapshots and disks, and the verification of snapshot policies.
Examples
List of snapshots which are not encrypted
Determine the areas in which snapshots lack encryption, allowing you to enhance your system's security by identifying potential vulnerabilities.
select name, snapshot_id, arn, encryptedfrom alicloud_ecs_snapshotwhere not encrypted;
select name, snapshot_id, arn, encryptedfrom alicloud_ecs_snapshotwhere encrypted = 0;
List of unused snapshots
Discover the snapshots which are currently not in use within your Alicloud Elastic Compute Service. This can help in managing resources efficiently by identifying and removing unused elements.
select name, snapshot_id, typefrom alicloud_ecs_snapshotwhere usage = 'none';
select name, snapshot_id, typefrom alicloud_ecs_snapshotwhere usage = 'none';
Find the snapshot count per disk
Uncover the details of how many snapshots each disk holds in your Alicloud ECS environment. This is useful in understanding the frequency of snapshots taken and can aid in storage management and cost optimization.
select source_disk_id, count(*) as snapshotfrom alicloud_ecs_snapshotgroup by source_disk_id;
select source_disk_id, count(*) as snapshotfrom alicloud_ecs_snapshotgroup by source_disk_id;
List of snapshots without owner tag key
Discover the segments that consist of snapshots lacking an 'owner' tag. This is particularly useful for identifying untagged resources that may lead to management issues or unnecessary costs.
select name, snapshot_id, tagsfrom alicloud_ecs_snapshotwhere tags ->> 'owner' is null;
select name, snapshot_id, tagsfrom alicloud_ecs_snapshotwhere json_extract(tags, '$.owner') is null;
List of snapshots older than 90 days
Determine the areas in which snapshots are older than 90 days in order to identify potential areas for data cleanup or archival. This can help optimize storage use and manage costs effectively.
select name, snapshot_id, type, creation_time, age(creation_time), retention_daysfrom alicloud_ecs_snapshotwhere creation_time <= (current_date - interval '90' day)order by creation_time;
select name, snapshot_id, type, creation_time, julianday('now') - julianday(creation_time) as age, retention_daysfrom alicloud_ecs_snapshotwhere julianday(creation_time) <= julianday(date('now', '-90 day'))order by creation_time;
Query examples
- ecs_images_for_ecs_snapshot
- ecs_instances_for_ecs_snapshot
- ecs_launch_templates_for_ecs_snapshot
- ecs_snapshot_1_year_count
- ecs_snapshot_24_hours_count
- ecs_snapshot_30_90_days_count
- ecs_snapshot_30_days_count
- ecs_snapshot_90_365_days_count
- ecs_snapshot_age
- ecs_snapshot_by_account
- ecs_snapshot_by_creation_month
- ecs_snapshot_by_region
- ecs_snapshot_by_usage
- ecs_snapshot_count
- ecs_snapshot_encryption
- ecs_snapshot_input
- ecs_snapshot_instant_access
- ecs_snapshot_overview
- ecs_snapshot_storage_by_account
- ecs_snapshot_storage_by_age
- ecs_snapshot_storage_by_region
- ecs_snapshot_storage_total
- ecs_snapshot_tags
- ecs_snapshot_usage
- ecs_snapshot_usage_source_disk_size
- ecs_snapshots_for_ecs_instance
- ecs_snapshots_for_kms_key
- ecs_unencrypted_snapshot_count
- ecs_unused_snapshot_count
- kms_key_rds_instances
- kms_keys_for_ecs_snapshot
- source_ecs_disks_for_ecs_snapshot
- source_ecs_snapshots_for_ecs_disk
- target_ecs_disks_for_ecs_snapshot
- target_ecs_snapshots_for_ecs_disk
Schema for alicloud_ecs_snapshot
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. | |
arn | text | The Alibaba Cloud Resource Name (ARN) of the snapshot. | |
creation_time | timestamp with time zone | The time when the snapshot was created. | |
description | text | A user provided, human readable description for this resource. | |
encrypted | boolean | Indicates whether the snapshot was encrypted. | |
instant_access | boolean | Indicates whether the instant access feature is enabled. | |
instant_access_retention_days | bigint | Indicates the retention period of the instant access feature. After the retention per iod ends, the snapshot is automatically released. | |
kms_key_id | text | The ID of the KMS key used by the data disk. | |
last_modified_time | timestamp with time zone | The time when the snapshot was last changed. | |
name | text | = | A friendly name for the resource. |
product_code | text | The product code of the Alibaba Cloud Marketplace image. | |
progress | text | The progress of the snapshot creation task. Unit: percent (%). | |
region | text | The region ID where the resource is located. | |
remain_time | bigint | The remaining time required to create the snapshot (in seconds). | |
resource_group_id | text | The ID of the resource group to which the snapshot belongs. | |
retention_days | bigint | The number of days that an automatic snapshot can be retained. | |
serial_number | text | The serial number of the snapshot. | |
snapshot_id | text | An unique identifier for the resource. | |
source_disk_id | text | The ID of the source disk. This parameter is retained even after the source disk of the snapshot is released. | |
source_disk_size | text | The capacity of the source disk (in GiB). | |
source_disk_type | text | The category of the source disk. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status | text | Specifies the current state of the resource. | |
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. | |
type | text | The type of the snapshot. Default value: all. Possible values are: auto, user, and all. | |
usage | text | Indicates whether the snapshot has been used to create images or disks. |
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_snapshot