Table: aws_redshift_snapshot - Query AWS Redshift Snapshots using SQL
The AWS Redshift Snapshot is a point-in-time copy of your data in AWS Redshift, a fully managed, petabyte-scale data warehouse service in the cloud. Snapshots are used to back up data and enable fast restore. They are automatically created by Redshift and can also be manually created by users.
Table Usage Guide
The aws_redshift_snapshot
table in Steampipe provides you with information about snapshots within AWS Redshift. This table allows you, as a DevOps engineer, to query snapshot-specific details, including the snapshot status, creation time, source cluster, and associated metadata. You can utilize this table to gather insights on snapshots, such as snapshot availability, size, and retention period. The schema outlines the various attributes of the Redshift snapshot for you, including the snapshot identifier, snapshot type, and associated tags.
Examples
Basic info
Explore which snapshots in your AWS Redshift database are encrypted. This can help you identify potential security risks and ensure that sensitive data is adequately protected.
select snapshot_identifier, cluster_identifier, node_type, encryptedfrom aws_redshift_snapshot;
select snapshot_identifier, cluster_identifier, node_type, encryptedfrom aws_redshift_snapshot;
List manual snapshots
Explore which snapshots have been manually created in your AWS Redshift environment. This can assist in understanding your data backup and recovery practices.
select snapshot_identifier, snapshot_typefrom aws_redshift_snapshotwhere snapshot_type = 'manual';
select snapshot_identifier, snapshot_typefrom aws_redshift_snapshotwhere snapshot_type = 'manual';
List unencrypted snapshots
Discover the segments that contain unencrypted snapshots in your AWS Redshift database. This is useful for identifying potential security risks and ensuring your data is properly protected.
select snapshot_identifier, cluster_identifier, node_type, number_of_nodes, encryptedfrom aws_redshift_snapshotwhere not encrypted;
select snapshot_identifier, cluster_identifier, node_type, number_of_nodes, encryptedfrom aws_redshift_snapshotwhere encrypted = 0;
Get cluster info for each snapshot
Explore the specifics of each snapshot, such as the associated cluster, its size, version, and potential restore options. This is useful for understanding the characteristics of each snapshot and for planning potential restore scenarios.
select snapshot_identifier, cluster_identifier, number_of_nodes, cluster_version, engine_full_version, restorable_node_typesfrom aws_redshift_snapshot;
select snapshot_identifier, cluster_identifier, number_of_nodes, cluster_version, engine_full_version, restorable_node_typesfrom aws_redshift_snapshot;
List snapshots that are shared with other accounts
Identify instances where snapshots are accessible to other accounts, a crucial step in assessing data sharing and privacy practices within your AWS Redshift environment.
select snapshot_identifier, accounts_with_restore_accessfrom aws_redshift_snapshotwhere accounts_with_restore_access is not null;
select snapshot_identifier, accounts_with_restore_accessfrom aws_redshift_snapshotwhere accounts_with_restore_access is not null;
List accounts that are authorized to restore each snapshot
Determine which accounts have permission to restore each snapshot in your AWS Redshift database. This is useful for auditing and managing data recovery permissions across your organization.
select snapshot_identifier, p ->> 'AccountId' as account_id, p ->> 'AccountAlias' as account_aliasfrom aws_redshift_snapshot, jsonb_array_elements(accounts_with_restore_access) as p;
select snapshot_identifier, json_extract(p.value, '$.AccountId') as account_id, json_extract(p.value, '$.AccountAlias') as account_aliasfrom aws_redshift_snapshot, json_each(accounts_with_restore_access) as p;
Query examples
- kms_keys_for_redshift_snapshot
- redshift_clusters_for_redshift_snapshot
- redshift_snapshot_backup_size
- redshift_snapshot_engine
- redshift_snapshot_input
- redshift_snapshot_node_type
- redshift_snapshot_overview
- redshift_snapshot_tags
- redshift_snapshot_type
- redshift_snapshot_unencrypted
- redshift_snapshots_for_redshift_cluster
Schema for aws_redshift_snapshot
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
accounts_with_restore_access | jsonb | A list of the AWS customer accounts authorized to restore the snapshot. | |
actual_incremental_backup_size_in_mega_bytes | double precision | The size of the incremental backup. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
availability_zone | text | The Availability Zone in which the cluster was created. | |
backup_progress_in_mega_bytes | double precision | The number of megabytes that have been transferred to the snapshot backup. | |
cluster_create_time | timestamp with time zone | The time (UTC) when the cluster was originally created. | |
cluster_identifier | text | = | The identifier of the cluster for which the snapshot was taken. |
cluster_version | text | The version ID of the Amazon Redshift engine that is running on the cluster. | |
current_backup_rate_in_mega_bytes_per_second | double precision | The number of megabytes per second being transferred to the snapshot backup. | |
db_name | text | The name of the database that was created when the cluster was created. | |
elapsed_time_in_seconds | text | The amount of time an in-progress snapshot backup has been running, or the amount of time it took a completed backup to finish. | |
encrypted | boolean | If true, the data in the snapshot is encrypted at rest. | |
encrypted_with_hsm | boolean | A boolean that indicates whether the snapshot data is encrypted using the HSM keys of the source cluster. | |
engine_full_version | text | The cluster version of the cluster used to create the snapshot. | |
enhanced_vpc_routing | boolean | An option that specifies whether to create the cluster with enhanced VPC routing enabled. | |
estimated_seconds_to_completion | text | The estimate of the time remaining before the snapshot backup will complete. | |
kms_key_id | text | The AWS KMS key ID of the encryption key that was used to encrypt data in the cluster from which the snapshot was taken. | |
maintenance_track_name | text | The name of the maintenance track for the snapshot. | |
manual_snapshot_remaining_days | bigint | The number of days until a manual snapshot will pass its retention period. | |
manual_snapshot_retention_period | bigint | The number of days that a manual snapshot is retained. | |
master_password_secret_arn | text | The Amazon Resource Name (ARN) for the cluster's admin user credentials secret. | |
master_password_secret_kms_key_id | text | The ID of the Key Management Service (KMS) key used to encrypt and store the cluster's admin credentials secret. | |
master_username | text | The master user name for the cluster. | |
node_type | text | The node type of the nodes in the cluster. | |
number_of_nodes | bigint | The number of nodes in the cluster. | |
owner_account | text | = | The AWS customer account used to create or copy the snapshot. |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
port | bigint | The port that the cluster is listening on. | |
region | text | The AWS Region in which the resource is located. | |
restorable_node_types | jsonb | The list of node types that this cluster snapshot is able to restore into. | |
snapshot_create_time | timestamp with time zone | = | The time (in UTC format) when Amazon Redshift began the snapshot. |
snapshot_identifier | text | = | The unique identifier of the cluster. |
snapshot_retention_start_time | timestamp with time zone | A timestamp representing the start of the retention period for the snapshot. | |
snapshot_type | text | = | The snapshot type. |
source_region | text | The source region from which the snapshot was copied. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status | text | The snapshot status. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | The list of tags for the cluster. | |
title | text | Title of the resource. | |
total_backup_size_in_mega_bytes | double precision | The size of the complete set of backup data that would be used to restore the cluster. | |
vpc_id | text | The VPC identifier of the cluster if the snapshot is from a cluster in a VPC. |
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)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_redshift_snapshot